public void onServiceConnected(ComponentName className, IBinder service) {
          KeyCachingService keyCachingService =
              ((KeyCachingService.KeyCachingBinder) service).getService();
          MasterSecret masterSecret = keyCachingService.getMasterSecret();

          initializeWithMasterSecret(masterSecret);

          if (masterSecret == null && !havePromptedForPassphrase) promptForPassphrase();

          Intent cachingIntent = new Intent(ConversationListActivity.this, KeyCachingService.class);
          startService(cachingIntent);

          try {
            ConversationListActivity.this.unbindService(this);
          } catch (IllegalArgumentException iae) {
            Log.w("SecureSMS", iae);
          }
        }
Пример #2
0
  @Override
  public void onRun() {
    Optional<IncomingTextMessage> message = assembleMessageFragments(pdus, subscriptionId);
    MasterSecret masterSecret = KeyCachingService.getMasterSecret(context);

    MasterSecretUnion masterSecretUnion;

    if (masterSecret == null) {
      masterSecretUnion =
          new MasterSecretUnion(MasterSecretUtil.getAsymmetricMasterSecret(context, null));
    } else {
      masterSecretUnion = new MasterSecretUnion(masterSecret);
    }

    if (message.isPresent() && !isBlocked(message.get())) {
      Pair<Long, Long> messageAndThreadId = storeMessage(masterSecretUnion, message.get());
      MessageNotifier.updateNotification(context, masterSecret, messageAndThreadId.second);
    } else if (message.isPresent()) {
      Log.w(TAG, "*** Received blocked SMS, ignoring...");
    }
  }