コード例 #1
0
ファイル: d.java プロジェクト: gdkjrygh/CompSecurity
 public static List a(Context context, int i1, String s)
     throws GoogleAuthException, IOException
 {
     g g1;
     am.a(s, "accountName must be provided");
     am.c("Calling this from your main thread can lead to deadlock");
     context = context.getApplicationContext();
     a(context);
     g1 = new g();
     if (!context.bindService(m, g1, 1))
     {
         break MISSING_BLOCK_LABEL_119;
     }
     s = com.google.android.gms.internal.dr.a.a(g1.a()).a((new AccountChangeEventsRequest()).a(s).a(i1)).a();
     context.unbindService(g1);
     return s;
     s;
     Log.i("GoogleAuthUtil", "GMS remote exception ", s);
     throw new IOException("remote exception");
     s;
     context.unbindService(g1);
     throw s;
     s;
     throw new GoogleAuthException("Interrupted");
     throw new IOException("Could not bind to service with the given context.");
 }
コード例 #2
0
  /*package*/ void close() {
    if (VDBG) log("close()");
    IBluetoothManager mgr = mAdapter.getBluetoothManager();
    if (mAdapter != null) {
      if (mgr != null) {
        try {
          mgr.unregisterStateChangeCallback(mBluetoothStateChangeCallback);
        } catch (Exception e) {
          Log.e(TAG, "", e);
        }
      }
    }

    synchronized (mConnection) {
      if (mService != null) {
        try {
          mService = null;
          mContext.unbindService(mConnection);
        } catch (Exception re) {
          Log.e(TAG, "", re);
        }
      }
    }
    mServiceListener = null;
  }
コード例 #3
0
 public void onBluetoothStateChange(boolean up) {
   if (DBG) Log.d(TAG, "onBluetoothStateChange: up=" + up);
   if (!up) {
     if (VDBG) Log.d(TAG, "Unbinding service...");
     synchronized (mConnection) {
       try {
         mService = null;
         mContext.unbindService(mConnection);
       } catch (Exception re) {
         Log.e(TAG, "", re);
       }
     }
   } else {
     synchronized (mConnection) {
       try {
         if (mService == null) {
           if (VDBG) Log.d(TAG, "Binding service...");
           doBind();
         }
       } catch (Exception re) {
         Log.e(TAG, "", re);
       }
     }
   }
 }
コード例 #4
0
 /**
  * Dispose of object, releasing resources. It's very important to call this method when you are
  * done with this object. It will release any resources used by it such as connection connections.
  * Naturally, once the object is disposed of, it can't be used again.
  */
 public void dispose() {
   if (connection != null) {
     if (context != null) context.unbindService(connection);
     connection = null;
     purchaseListener = null;
   }
 }
コード例 #5
0
 /**
  * Close the connection to the backing service. Other public functions of BluetoothPbap will
  * return default error results once close() has been called. Multiple invocations of close() are
  * ok.
  */
 public synchronized void close() {
   if (mConnection != null && mService != null) {
     mContext.unbindService(mConnection);
   }
   mConnection = null;
   mServiceListener = null;
 }
コード例 #6
0
ファイル: FaceUnlock.java プロジェクト: BvbKoala/SourceCode
  /** Stops Face Unlock and unbinds from the service. Called on the UI thread. */
  public boolean stop() {
    if (DEBUG) Log.d(TAG, "stop()");
    if (mHandler.getLooper() != Looper.myLooper()) {
      Log.e(TAG, "stop() called off of the UI thread");
    }

    boolean mWasRunning = mIsRunning;
    stopUi();

    if (mBoundToService) {
      if (mService != null) {
        try {
          mService.unregisterCallback(mFaceUnlockCallback);
        } catch (RemoteException e) {
          // Not much we can do
        }
      }
      Log.d(TAG, "Unbinding from Face Unlock service");
      mContext.unbindService(mConnection);
      mBoundToService = false;
    } else {
      // This is usually not an error when this happens.  Sometimes we will tell it to
      // unbind multiple times because it's called from both onWindowFocusChanged and
      // onDetachedFromWindow.
      if (DEBUG) Log.d(TAG, "Attempt to unbind from Face Unlock when not bound");
    }
    mIsRunning = false;
    return mWasRunning;
  }
コード例 #7
0
  public void onServiceConnected(ComponentName className, IBinder service) {
    // Get the OpenUDID from the remote service
    try {
      // Send a random number to the service
      android.os.Parcel data = android.os.Parcel.obtain();
      data.writeInt(mRandom.nextInt());
      android.os.Parcel reply = android.os.Parcel.obtain();
      service.transact(1, android.os.Parcel.obtain(), reply, 0);
      if (data.readInt() == reply.readInt()) // Check if the service returns us this number
      {
        final String _openUDID = reply.readString();
        if (_openUDID != null) { // if valid OpenUDID, save it
          if (LOG) Log.d(TAG, "Received " + _openUDID);

          if (mReceivedOpenUDIDs.containsKey(_openUDID))
            mReceivedOpenUDIDs.put(_openUDID, mReceivedOpenUDIDs.get(_openUDID) + 1);
          else mReceivedOpenUDIDs.put(_openUDID, 1);
        }
      }
    } catch (RemoteException e) {
      if (LOG) Log.e(TAG, "RemoteException: " + e.getMessage());
    }
    mContext.unbindService(this);

    startService(); // Try the next one
  }
コード例 #8
0
 private void unbind() {
   if (mBound) {
     mBound = false;
     mContext.unbindService(mConnection);
     mUpdatesMap.clear();
   }
 }
コード例 #9
0
 private void unbindService(ServiceConnection connection) {
   try {
     mContext.unbindService(connection);
   } catch (Exception e) {
     Log.e(TAG, "unbindServer error. " + e);
   }
   connection = null;
 }
コード例 #10
0
 void dispose() {
   if (mWapPushManager != null) {
     if (DBG) Rlog.v(TAG, "dispose: unbind wappush manager");
     mContext.unbindService(this);
   } else {
     Rlog.e(TAG, "dispose: not bound to a wappush manager");
   }
 }
コード例 #11
0
 /**
  * BLUETI_ENHANCEMENT- Close the connection to the backing service. Other public functions of
  * BluetoothHeadset will return default error results once close() has been called. Multiple
  * invocations of close() are ok.
  *
  * @hide
  */
 public synchronized void close() {
   if (DBG) log("close()");
   if (mConnection != null) {
     mContext.unbindService(mConnection);
     mConnection = null;
   }
   mServiceListener = null;
 }
コード例 #12
0
 public void onDestroy() {
   if (mFavoriteReceiver != null) {
     mContext.unregisterReceiver(mFavoriteReceiver);
     mFavoriteReceiver = null;
   }
   Log.i("cuiqian", "pee onDestroy");
   mContext.unbindService(serviceConnection);
 }
コード例 #13
0
 private void doUnbindService() {
   if (mIsBound) {
     Context context = libriDroidPlayerService.getApplicationContext();
     // Detach our existing connection.
     context.unbindService(mConnection);
     mIsBound = false;
   }
 }
コード例 #14
0
 public void stopService(final ServiceConnection connection) {
   try {
     Intent intent = new Intent(context, NotificationService.class);
     context.stopService(intent);
     context.unbindService(connection);
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
コード例 #15
0
 /** @see com.jdroid.android.billing.BillingManager#unbind() */
 @Override
 public void unbind() {
   try {
     context.unbindService(this);
     context = null;
   } catch (IllegalArgumentException e) {
     // This might happen if the service was disconnected
   }
 }
コード例 #16
0
  public void unbindAppService() {

    AppLog.d(context, "AppServiceConnection: unbindAppService");

    // detach our existing connection
    context.unbindService(serviceConnection);

    appService = null;
  }
コード例 #17
0
 @Override
 public void run() {
   synchronized (mScreenshotLock) {
     if (mScreenshotConnection != null) {
       mContext.unbindService(mScreenshotConnection);
       mScreenshotConnection = null;
     }
   }
 }
コード例 #18
0
 public void onServiceDisconnected(ComponentName name) {
   sender = null;
   try {
     context.unbindService(this);
   } catch (IllegalArgumentException ex) {
     // Do nothing, the connection was already unbound
   }
   callback(null);
 }
コード例 #19
0
 private void ensureServiceUnbound(ListenerRecord paramListenerRecord)
 {
   if (paramListenerRecord.bound)
   {
     mContext.unbindService(this);
     paramListenerRecord.bound = false;
   }
   paramListenerRecord.service = null;
 }
コード例 #20
0
ファイル: eau.java プロジェクト: FabianTerhorst/Hangouts
 public void onServiceConnected(ComponentName componentname, IBinder ibinder)
 {
     eev.e("Babel_telephony", "TeleTychoController.HomeVocieNetworkConnection.onServiceConnected");
     componentname = eku.a(ibinder);
     b.a(true, componentname.b());
     b = null;
     a.unbindService(this);
     return;
     componentname;
     eev.e("Babel_telephony", "TeleTychoController.HomeVocieNetworkConnection.onServiceConnected, calling isOnHomeVoiceNetwork failed", componentname);
     b.a(false, false);
     b = null;
     a.unbindService(this);
     return;
     componentname;
     b = null;
     a.unbindService(this);
     throw componentname;
 }
コード例 #21
0
ファイル: IabHelper.java プロジェクト: jpsmaia/MoSync
 /**
  * Dispose of object, releasing resources. It's very important to call this method when you are
  * done with this object. It will release any resources used by it such as service connections.
  * Naturally, once the object is disposed of, it can't be used again.
  */
 public void dispose() {
   logDebug("Disposing.");
   mSetupDone = false;
   if (mServiceConn != null) {
     logDebug("Unbinding from service.");
     if (mContext != null) mContext.unbindService(mServiceConn);
     mServiceConn = null;
     mService = null;
     mPurchaseListener = null;
   }
 }
コード例 #22
0
 protected void handleMessage(Message message) {
   if (message.what == replyMessage) {
     Bundle extras = message.getData();
     String errorType = extras.getString(NativeProtocol.STATUS_ERROR_TYPE);
     if (errorType != null) {
       callback(null);
     } else {
       callback(extras);
     }
     context.unbindService(this);
   }
 }
 @Override
 public void onServiceConnected(ComponentName name, IBinder service) {
   USBConnectionService remoteStubService = USBConnectionService.Stub.asInterface(service);
   try {
     callback.onUSBConnected(remoteStubService.isConnected());
   } catch (RemoteException e) {
     callback.onUSBConnectionError(e);
     e.printStackTrace();
   } finally {
     context.unbindService(usbConnectionService);
   }
 }
コード例 #24
0
 private void handleMessage(Message message) {
   if (message.what == NativeProtocol.MESSAGE_GET_ACCESS_TOKEN_REPLY) {
     Bundle extras = message.getData();
     String errorType = extras.getString(NativeProtocol.STATUS_ERROR_TYPE);
     if (errorType != null) {
       callback(null);
     } else {
       callback(extras);
     }
     context.unbindService(this);
   }
 }
コード例 #25
0
ファイル: d.java プロジェクト: gdkjrygh/CompSecurity
 public static void b(Context context, String s)
     throws GooglePlayServicesAvailabilityException, GoogleAuthException, IOException
 {
     Context context1;
     Object obj;
     context1 = context.getApplicationContext();
     am.c("Calling this from your main thread can lead to deadlock");
     a(context1);
     obj = new Bundle();
     context = context.getApplicationInfo().packageName;
     ((Bundle) (obj)).putString("clientPackageName", context);
     if (!((Bundle) (obj)).containsKey(c))
     {
         ((Bundle) (obj)).putString(c, context);
     }
     context = new g();
     if (!context1.bindService(m, context, 1))
     {
         break MISSING_BLOCK_LABEL_162;
     }
     s = com.google.android.gms.internal.dr.a.a(context.a()).a(s, ((Bundle) (obj)));
     obj = s.getString(ii.T);
     if (!s.getBoolean("booleanResult"))
     {
         throw new GoogleAuthException(((String) (obj)));
     }
     break MISSING_BLOCK_LABEL_145;
     s;
     Log.i("GoogleAuthUtil", "GMS remote exception ", s);
     throw new IOException("remote exception");
     s;
     context1.unbindService(context);
     throw s;
     context1.unbindService(context);
     return;
     s;
     throw new GoogleAuthException("Interrupted");
     throw new IOException("Could not bind to service with the given context.");
 }
コード例 #26
0
 public void unbindService(Context ctx) {
   Log.d(TAG, "Unbinding");
   handler = null;
   bound = false;
   if (mService != null) {
     try {
       mService.unRegisterCallback(mCallback);
     } catch (RemoteException e) {
       // throw new RuntimeException(e);
     }
   }
   ctx.unbindService(this);
 }
コード例 #27
0
 private boolean ensureServiceBound(ListenerRecord paramListenerRecord)
 {
   if (paramListenerRecord.bound)
     return true;
   Intent localIntent = new Intent("android.support.BIND_NOTIFICATION_SIDE_CHANNEL").setComponent(paramListenerRecord.componentName);
   paramListenerRecord.bound = mContext.bindService(localIntent, this, NotificationManagerCompat.SIDE_CHANNEL_BIND_FLAGS);
   if (paramListenerRecord.bound)
     paramListenerRecord.retryCount = 0;
   while (true)
   {
     return paramListenerRecord.bound;
     Log.w("NotifManCompat", "Unable to bind to listener " + paramListenerRecord.componentName);
     mContext.unbindService(this);
   }
 }
コード例 #28
0
 /** Means by which an Activity lifecycle aware object hints about binding and unbinding */
 public void shutdown(Context context) {
   //      Log.d( TAG, "disconnectFromGPSLoggerService()" );
   synchronized (mStartLock) {
     try {
       if (mBound) {
         //               Log.d( TAG, "unbindService()"+this.mServiceConnection );
         context.unbindService(this.mServiceConnection);
         GPSLoggerServiceManager.this.mGPSLoggerRemote = null;
         mServiceConnection = null;
         mBound = false;
       }
     } catch (IllegalArgumentException e) {
       Log.w(TAG, "Failed to unbind a service, prehaps the service disapearded?", e);
     }
   }
 }
コード例 #29
0
  public void endTask() {
    try {
      mContext.unbindService(mConnection);
    } catch (IllegalArgumentException e) {
      // This can happen if the user ended the activity that was using the service
      // This is harmless, but we've got to catch it
    }

    mDead = true;
    synchronized (mConnection) {
      if (DEBUG_PROXY) {
        Log.v(mTag, "Task " + mName + " completed; disconnecting");
      }
      mConnection.notify();
    }
  }
コード例 #30
0
ファイル: API.java プロジェクト: william-diego/Mobilyzer
 /** Unbind from scheduler, called in activity's onDestroy callback function */
 public void unbind() {
   Logger.e("API-> unbind called");
   if (isBound) {
     Logger.e("API-> unbind called 2");
     // Register client key
     Message msg = Message.obtain(null, Config.MSG_UNREGISTER_CLIENTKEY);
     Bundle data = new Bundle();
     data.putString(UpdateIntent.CLIENTKEY_PAYLOAD, clientKey);
     msg.setData(data);
     try {
       sendMessage(msg);
     } catch (MeasurementError e) {
       Logger.e("Unregister clientKey failed", e);
     }
     // Unbind service
     applicationContext.unbindService(serviceConn);
     isBound = false;
   }
 }