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

Commit 9b1ed6b0 authored by paulhu's avatar paulhu
Browse files

Replace PendingIntent @hide APIs

Connectivity service module is using some PendingIntent @hide
APIs but they are not able to call after CS becomes a mainline
module. Thus, replace them with similar System APIs.

Bug: 170593746
Test: atest FrameworksNetTests
      Manually test notifications can show normally.
Change-Id: I92ab7216f5fd46d449b6d8f80d3441f8966ac890
parent 529cda4f
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -3998,13 +3998,11 @@ public class ConnectivityService extends IConnectivityManager.Stub
                    settingsPkgName + ".wifi.WifiNoInternetDialog");
        }

        PendingIntent pendingIntent = PendingIntent.getActivityAsUser(
                mContext,
        PendingIntent pendingIntent = PendingIntent.getActivity(
                mContext.createContextAsUser(UserHandle.CURRENT, 0 /* flags */),
                0 /* requestCode */,
                intent,
                PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_IMMUTABLE,
                null /* options */,
                UserHandle.CURRENT);
                PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_IMMUTABLE);

        mNotifier.showNotification(nai.network.netId, type, nai, null, pendingIntent, highPriority);
    }
+5 −3
Original line number Diff line number Diff line
@@ -159,9 +159,11 @@ public class LingerMonitor {

    @VisibleForTesting
    protected PendingIntent createNotificationIntent() {
        return PendingIntent.getActivityAsUser(mContext, 0 /* requestCode */, CELLULAR_SETTINGS,
                PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_IMMUTABLE,
                null /* options */, UserHandle.CURRENT);
        return PendingIntent.getActivity(
                mContext.createContextAsUser(UserHandle.CURRENT, 0 /* flags */),
                0 /* requestCode */,
                CELLULAR_SETTINGS,
                PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_IMMUTABLE);
    }

    // Removes any notification that was put up as a result of switching to nai.
+3 −2
Original line number Diff line number Diff line
@@ -1960,8 +1960,9 @@ public class Vpn {
         */
        public PendingIntent pendingIntentGetActivityAsUser(
                Intent intent, int flags, UserHandle user) {
            return PendingIntent.getActivityAsUser(mContext, 0 /*request*/, intent, flags,
                    null /*options*/, user);
            return PendingIntent.getActivity(
                    mContext.createContextAsUser(user, 0 /* flags */), 0 /* requestCode */,
                    intent, flags);
        }

        /**