@Test public void handleMessage_startExecution_noData() throws Exception { Message message = Message.obtain(); message.what = GooglePlayMessageHandler.MSG_START_EXEC; message.replyTo = messengerMock; handler.handleMessage(message); verify(receiverMock, never()) .prepareJob(any(GooglePlayMessengerCallback.class), any(Bundle.class)); }
@Override public void handleMessage(Message message) { if (message == null) { return; } AppOpsManager appOpsManager = (AppOpsManager) googlePlayReceiver.getApplicationContext().getSystemService(Context.APP_OPS_SERVICE); try { appOpsManager.checkPackage(message.sendingUid, GooglePlayDriver.BACKEND_PACKAGE); } catch (SecurityException e) { Log.e(TAG, "Message was not sent from GCM."); return; } switch (message.what) { case MSG_START_EXEC: handleStartMessage(message); break; case MSG_STOP_EXEC: handleStopMessage(message); break; case MSG_INIT: break; default: Log.e(TAG, "Unrecognized message received: " + message); break; } }
GooglePlayMessageHandler extends Handler { @Override public void handleMessage(Message message) { if (message == null) { return; } AppOpsManager appOpsManager = (AppOpsManager) googlePlayReceiver.getApplicationContext().getSystemService(Context.APP_OPS_SERVICE); try { appOpsManager.checkPackage(message.sendingUid, GooglePlayDriver.BACKEND_PACKAGE); } catch (SecurityException e) { Log.e(TAG, "Message was not sent from GCM."); return; } switch (message.what) { case MSG_START_EXEC: handleStartMessage(message); break; case MSG_STOP_EXEC: handleStopMessage(message); break; case MSG_INIT: break; default: Log.e(TAG, "Unrecognized message received: " + message); break; } } }
GooglePlayMessageHandler extends Handler { @Override public void handleMessage(Message message) { if (message == null) { return; } AppOpsManager appOpsManager = (AppOpsManager) googlePlayReceiver.getApplicationContext().getSystemService(Context.APP_OPS_SERVICE); try { appOpsManager.checkPackage(message.sendingUid, GooglePlayDriver.BACKEND_PACKAGE); } catch (SecurityException e) { Log.e(TAG, "Message was not sent from GCM."); return; } switch (message.what) { case MSG_START_EXEC: handleStartMessage(message); break; case MSG_STOP_EXEC: handleStopMessage(message); break; case MSG_INIT: break; default: Log.e(TAG, "Unrecognized message received: " + message); break; } } GooglePlayMessageHandler(Looper mainLooper, GooglePlayReceiver googlePlayReceiver); }
GooglePlayMessageHandler extends Handler { @Override public void handleMessage(Message message) { if (message == null) { return; } AppOpsManager appOpsManager = (AppOpsManager) googlePlayReceiver.getApplicationContext().getSystemService(Context.APP_OPS_SERVICE); try { appOpsManager.checkPackage(message.sendingUid, GooglePlayDriver.BACKEND_PACKAGE); } catch (SecurityException e) { Log.e(TAG, "Message was not sent from GCM."); return; } switch (message.what) { case MSG_START_EXEC: handleStartMessage(message); break; case MSG_STOP_EXEC: handleStopMessage(message); break; case MSG_INIT: break; default: Log.e(TAG, "Unrecognized message received: " + message); break; } } GooglePlayMessageHandler(Looper mainLooper, GooglePlayReceiver googlePlayReceiver); @Override void handleMessage(Message message); }
GooglePlayMessageHandler extends Handler { @Override public void handleMessage(Message message) { if (message == null) { return; } AppOpsManager appOpsManager = (AppOpsManager) googlePlayReceiver.getApplicationContext().getSystemService(Context.APP_OPS_SERVICE); try { appOpsManager.checkPackage(message.sendingUid, GooglePlayDriver.BACKEND_PACKAGE); } catch (SecurityException e) { Log.e(TAG, "Message was not sent from GCM."); return; } switch (message.what) { case MSG_START_EXEC: handleStartMessage(message); break; case MSG_STOP_EXEC: handleStopMessage(message); break; case MSG_INIT: break; default: Log.e(TAG, "Unrecognized message received: " + message); break; } } GooglePlayMessageHandler(Looper mainLooper, GooglePlayReceiver googlePlayReceiver); @Override void handleMessage(Message message);  }