Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4e798ce1 authored by Varun Berry's avatar Varun Berry Committed by Automerger Merge Worker
Browse files

Add a permission to guard receiving intents in StatusSmsFetcher. am:...

Add a permission to guard receiving intents in StatusSmsFetcher. am: f7944b6c am: b9370c05 am: c8a7a2bd am: 1dc0d907 am: b78fa3b0

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Dialer/+/16199730

Change-Id: I193277543899ec446f8b933a7ca3d08d0c08e127
parents e6db9dfd b78fa3b0
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -74,6 +74,10 @@
   presses home. -->
  <uses-permission android:name="android.permission.STOP_APP_SWITCHES"/>

  <!-- Used for sending PendingIntents to dynamically registered receivers -->
  <uses-permission android:name="com.android.dialer.permission.DIALER_ORIGIN"
    android:protectionLevel="signature" />

  <!-- Permissions needed for badger count showing on launch icon. -->

  <!--for Samsung-->
+9 −2
Original line number Diff line number Diff line
@@ -53,8 +53,12 @@ public class StatusSmsFetcher extends BroadcastReceiver implements Closeable {

  private static final long STATUS_SMS_TIMEOUT_MILLIS = 60_000;

  private static final String PERMISSION_DIALER_ORIGIN =
    "com.android.dialer.permission.DIALER_ORIGIN";

  private static final String ACTION_REQUEST_SENT_INTENT =
      "com.android.voicemailomtp.sms.REQUEST_SENT";

  private static final int ACTION_REQUEST_SENT_REQUEST_CODE = 0;

  private CompletableFuture<Bundle> future = new CompletableFuture<>();
@@ -67,7 +71,7 @@ public class StatusSmsFetcher extends BroadcastReceiver implements Closeable {
    this.phoneAccountHandle = phoneAccountHandle;
    IntentFilter filter = new IntentFilter(ACTION_REQUEST_SENT_INTENT);
    filter.addAction(OmtpService.ACTION_SMS_RECEIVED);
    context.registerReceiver(this, filter);
    context.registerReceiver(this, filter, PERMISSION_DIALER_ORIGIN, /* scheduler= */ null);
  }

  @Override
@@ -89,7 +93,10 @@ public class StatusSmsFetcher extends BroadcastReceiver implements Closeable {
    // Because the receiver is registered dynamically, implicit intent must be used.
    // There should only be a single status SMS request at a time.
    return PendingIntent.getBroadcast(
        context, ACTION_REQUEST_SENT_REQUEST_CODE, intent, PendingIntent.FLAG_CANCEL_CURRENT);
        context,
        ACTION_REQUEST_SENT_REQUEST_CODE,
        intent,
        PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_IMMUTABLE);
  }

  @Override