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

Unverified Commit f66f095b authored by Kevin F. Haggerty's avatar Kevin F. Haggerty
Browse files

Merge tag 'android-8.1.0_r76' of...

Merge tag 'android-8.1.0_r76' of https://android.googlesource.com/platform/frameworks/base into staging/lineage-15.1_merge-android-8.1.0_r76

Android 8.1.0 release 76

* tag 'android-8.1.0_r76' of https://android.googlesource.com/platform/frameworks/base:
  Verify all possible hosts that match web nav
  RESTRICT AUTOMERGE Prevent accessing companion records from arbitrary uids
  Revert "DO NOT MERGE - Kill apps outright for API contract violations"
  RESTRICT AUTOMERGE Create separated tasks for different apps from startActivities
  RESTRICT AUTOMERGE Use consistent calling uid and package in navigateUpTo
  DO NOT MERGE - Kill apps outright for API contract violations

Change-Id: Ifd6c66f2bfe7847ab073ea3eca1ba4c4947e3d58
parents 6aed87b6 5f03b08b
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -2843,6 +2843,11 @@
    <permission android:name="android.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS"
        android:protectionLevel="signature|privileged" />

    <!-- Allows an application to manage the companion devices.
         @hide -->
    <permission android:name="android.permission.MANAGE_COMPANION_DEVICES"
                android:protectionLevel="signature" />

    <!-- @SystemApi Allows an application to use SurfaceFlinger's low level features.
         <p>Not for use by third-party applications.
         @hide
+5 −0
Original line number Diff line number Diff line
@@ -624,6 +624,11 @@ public class CompanionDeviceManagerService extends SystemService implements Bind
                + "associate USER_ID PACKAGE MAC_ADDRESS\n"
                + "disassociate USER_ID PACKAGE MAC_ADDRESS";

        ShellCmd() {
            getContext().enforceCallingOrSelfPermission(
                    android.Manifest.permission.MANAGE_COMPANION_DEVICES, "ShellCmd");
        }

        @Override
        public int onCommand(String cmd) {
            switch (cmd) {
+4 −1
Original line number Diff line number Diff line
@@ -6987,7 +6987,7 @@ public class ActivityManagerService extends IActivityManager.Stub
        }
    }
    private final boolean attachApplicationLocked(IApplicationThread thread,
    private boolean attachApplicationLocked(@NonNull IApplicationThread thread,
            int pid) {
        // Find the application record that is being attached...  either via
@@ -7292,6 +7292,9 @@ public class ActivityManagerService extends IActivityManager.Stub
    @Override
    public final void attachApplication(IApplicationThread thread) {
        if (thread == null) {
            throw new SecurityException("Invalid application interface");
        }
        synchronized (this) {
            int callingPid = Binder.getCallingPid();
            final long origId = Binder.clearCallingIdentity();
+9 −4
Original line number Diff line number Diff line
@@ -3961,6 +3961,11 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai

    final boolean navigateUpToLocked(ActivityRecord srec, Intent destIntent, int resultCode,
            Intent resultData) {
        if (srec.app == null || srec.app.thread == null) {
            // Nothing to do if the caller is not attached, because this method should be called
            // from an alive activity.
            return false;
        }
        final TaskRecord task = srec.getTask();
        final ArrayList<ActivityRecord> activities = task.mActivities;
        final int start = activities.indexOf(srec);
@@ -4012,22 +4017,22 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
        }

        if (parent != null && foundParentInTask) {
            final int callingUid = srec.info.applicationInfo.uid;
            final int parentLaunchMode = parent.info.launchMode;
            final int destIntentFlags = destIntent.getFlags();
            if (parentLaunchMode == ActivityInfo.LAUNCH_SINGLE_INSTANCE ||
                    parentLaunchMode == ActivityInfo.LAUNCH_SINGLE_TASK ||
                    parentLaunchMode == ActivityInfo.LAUNCH_SINGLE_TOP ||
                    (destIntentFlags & Intent.FLAG_ACTIVITY_CLEAR_TOP) != 0) {
                parent.deliverNewIntentLocked(srec.info.applicationInfo.uid, destIntent,
                        srec.packageName);
                parent.deliverNewIntentLocked(callingUid, destIntent, srec.packageName);
            } else {
                try {
                    ActivityInfo aInfo = AppGlobals.getPackageManager().getActivityInfo(
                            destIntent.getComponent(), 0, srec.userId);
                    int res = mService.mActivityStarter.startActivityLocked(srec.app.thread,
                            destIntent, null /*ephemeralIntent*/, null, aInfo, null /*rInfo*/, null,
                            null, parent.appToken, null, 0, -1, parent.launchedFromUid,
                            parent.launchedFromPackage, -1, parent.launchedFromUid, 0, null,
                            null, parent.appToken, null, 0, -1, callingUid,
                            srec.packageName, -1, callingUid, 0, null,
                            false, true, null, null, "navigateUpTo");
                    foundParentInTask = res == ActivityManager.START_SUCCESS;
                } catch (RemoteException e) {
+16 −1
Original line number Diff line number Diff line
@@ -940,6 +940,8 @@ class ActivityStarter {
        } else {
            callingPid = callingUid = -1;
        }
        boolean forceNewTask = false;
        final int filterCallingUid = callingUid >= 0 ? callingUid : realCallingUid;
        final long origId = Binder.clearCallingIdentity();
        try {
            synchronized (mService) {
@@ -959,6 +961,9 @@ class ActivityStarter {

                    // Don't modify the client's object!
                    intent = new Intent(intent);
                    if (forceNewTask) {
                        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    }

                    // Collect information about the target of the Intent.
                    ActivityInfo aInfo = mSupervisor.resolveActivity(intent, resolvedTypes[i], 0,
@@ -984,7 +989,17 @@ class ActivityStarter {
                        return res;
                    }

                    resultTo = outActivity[0] != null ? outActivity[0].appToken : null;
                    final ActivityRecord started = outActivity[0];
                    if (started != null && started.getUid() == filterCallingUid) {
                        // Only the started activity which has the same uid as the source caller can
                        // be the caller of next activity.
                        resultTo = started.appToken;
                        forceNewTask = false;
                    } else {
                        // Different apps not adjacent to the caller are forced to be new task.
                        resultTo = null;
                        forceNewTask = true;
                    }
                }
            }
        } finally {
Loading