diff options
Diffstat (limited to 'mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/service/OemService.java')
-rw-r--r-- | mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/service/OemService.java | 68 |
1 files changed, 35 insertions, 33 deletions
diff --git a/mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/service/OemService.java b/mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/service/OemService.java index f6382e2..70ec091 100644 --- a/mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/service/OemService.java +++ b/mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/service/OemService.java @@ -3,29 +3,29 @@ Copyright © Trustonic Limited 2013 All rights reserved. -Redistribution and use in source and binary forms, with or without modification, +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - 1. Redistributions of source code must retain the above copyright notice, this + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - 3. Neither the name of the Trustonic Limited nor the names of its contributors - may be used to endorse or promote products derived from this software + 3. Neither the name of the Trustonic Limited nor the names of its contributors + may be used to endorse or promote products derived from this software without specific prior written permission. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -52,7 +52,7 @@ public class OemService extends BaseService { private final RootPAOemIfc.Stub mBinder = new ServiceIfc(); private static final int OEM_UID_FOR_LOCK=0x33330000; - + private class ServiceIfc extends RootPAOemIfc.Stub { public ServiceIfc(){ super(); @@ -61,43 +61,43 @@ public class OemService extends BaseService { private CommonPAWrapper commonPAWrapper(){ return OemService.this.commonPAWrapper(); } - + public CommandResult unregisterRootContainer(){ - Log.d(TAG,">>RootPAServiceIfc.Stub.unregisterRootContainer"); + Log.d(TAG,">>RootPAServiceIfc.Stub.unregisterRootContainer"); int tmpSuid=OEM_UID_FOR_LOCK+new Random().nextInt(); // this may override the uid used in lock, which means it will not be - + if(!OemService.this.acquireLock(tmpSuid, false).isOk()){ return new CommandResult(CommandResult.ROOTPA_ERROR_LOCK); } doProvisioningLockSuid_=tmpSuid; Log.d(TAG,"RootPAServiceIfc.Stub.unregisterRootContainer calling JNI"); - + int ret=CommandResult.ROOTPA_OK; try{ setupProxy(); - ret=commonPAWrapper().unregisterRootContainer(se_); + ret=commonPAWrapper().unregisterRootContainer(se_); }catch(Exception e){ Log.e(TAG,"CommonPAWrapper().unregisterRootContainer exception: ", e); ret=CommandResult.ROOTPA_ERROR_INTERNAL; } - + CommandResult res=OemService.this.releaseLock(doProvisioningLockSuid_, false); if(!res.isOk()){ Log.e(TAG,"releasing lock failed, res: "+res.result()); // this return code is not returned to the client since // the command may have succeeded and there is just something wrong with the lock // we leave it the the next command if the problem remains - } - - Log.d(TAG,"<<RootPAServiceIfc.Stub.unregisterRootContainer"); + } + + Log.d(TAG,"<<RootPAServiceIfc.Stub.unregisterRootContainer"); return new CommandResult(ret); } - + } - + @Override public void onCreate() { Log.d(TAG,"Hello, OemService onCreate"); @@ -107,14 +107,14 @@ public class OemService extends BaseService { @Override public void onLowMemory() { Log.d(TAG,"OemService onLowMemory"); - super.onLowMemory(); + super.onLowMemory(); } public void onDestroy(){ - super.onDestroy(); + super.onDestroy(); Log.d(TAG,"OemService being destroyed"); } - + @Override public IBinder onBind(Intent intent){ try{ @@ -123,7 +123,7 @@ public class OemService extends BaseService { Log.i(TAG,"OemService something wrong in the given ip "+e ); } - try{ + try{ Log.setLoggingLevel(intent.getIntExtra("LOG",0)); }catch(Exception e){ Log.i(TAG,"OemService something wrong in the given logging level "+e ); @@ -136,6 +136,8 @@ public class OemService extends BaseService { @Override public int onStartCommand(Intent i, int flags, int startid){ Log.d(TAG,"OemService starting"); - return START_STICKY; - } + return START_STICKY; + } } + + |