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

Commit 48eec197 authored by Sarah Chin's avatar Sarah Chin
Browse files

Move phone ID to extra for action provision

Previously, the phone ID was appended to the broadcast in DCT and sent
to ConnectivityManager. Instead of sending both as an action, send the
phone ID as an extra instead to make the action a protected broadcast.

Test: manually verify a SecurityException when action provision is sent
Test: atest DcTrackerTest
Bug: 172459128
Change-Id: Ic4129def86949d7191d15056852718dadbd72fba
parent 027e0e0d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -3165,7 +3165,7 @@ public class ConnectivityManager {
    /**
     * Set sign in error notification to visible or invisible
     *
     * {@hide}
     * @hide
     * @deprecated Doesn't properly deal with multiple connected networks of the same type.
     */
    @Deprecated
+7 −1
Original line number Diff line number Diff line
@@ -334,7 +334,13 @@ public class NetworkNotificationManager {
     */
    public void setProvNotificationVisible(boolean visible, int id, String action) {
        if (visible) {
            Intent intent = new Intent(action);
            // For legacy purposes, action is sent as the action + the phone ID from DcTracker.
            // Split the string here and send the phone ID as an extra instead.
            String[] splitAction = action.split(":");
            Intent intent = new Intent(splitAction[0]);
            try {
                intent.putExtra("provision.phone.id", Integer.parseInt(splitAction[1]));
            } catch (NumberFormatException ignored) { }
            PendingIntent pendingIntent = PendingIntent.getBroadcast(
                    mContext, 0 /* requestCode */, intent, PendingIntent.FLAG_IMMUTABLE);
            showNotification(id, NotificationType.SIGN_IN, null, null, pendingIntent, false);