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

Commit bbe0c62d authored by Bill Yi's avatar Bill Yi Committed by Gerrit Code Review
Browse files

Merge "Merge SP2A.220405.004 to aosp-master - DO NOT MERGE"

parents 7af43734 95267eaf
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -683,6 +683,7 @@ package android.content {
    ctor public AttributionSource(int, @Nullable String, @Nullable String);
    ctor public AttributionSource(int, @Nullable String, @Nullable String, @NonNull android.os.IBinder);
    ctor public AttributionSource(int, @Nullable String, @Nullable String, @Nullable java.util.Set<java.lang.String>, @Nullable android.content.AttributionSource);
    method public void enforceCallingPid();
  }

  public final class AutofillOptions implements android.os.Parcelable {
+42 −4
Original line number Diff line number Diff line
@@ -155,8 +155,8 @@ public final class AttributionSource implements Parcelable {
        this(AttributionSourceState.CREATOR.createFromParcel(in));

        // Since we just unpacked this object as part of it transiting a Binder
        // call, this is the perfect time to enforce that its UID can be trusted
        enforceCallingUid();
        // call, this is the perfect time to enforce that its UID and PID can be trusted
        enforceCallingUidAndPid();
    }

    /** @hide */
@@ -258,14 +258,25 @@ public final class AttributionSource implements Parcelable {
        }
    }

    /**
     * If you are handling an IPC and you don't trust the caller you need to validate whether the
     * attribution source is one for the calling app to prevent the caller to pass you a source from
     * another app without including themselves in the attribution chain.
     *
     * @throws SecurityException if the attribution source cannot be trusted to be from the caller.
     */
    private void enforceCallingUidAndPid() {
        enforceCallingUid();
        enforceCallingPid();
    }

    /**
     * If you are handling an IPC and you don't trust the caller you need to validate
     * whether the attribution source is one for the calling app to prevent the caller
     * to pass you a source from another app without including themselves in the
     * attribution chain.
     *
     * @throws SecurityException if the attribution source cannot be trusted to be
     * from the caller.
     * @throws SecurityException if the attribution source cannot be trusted to be from the caller.
     */
    public void enforceCallingUid() {
        if (!checkCallingUid()) {
@@ -294,6 +305,33 @@ public final class AttributionSource implements Parcelable {
        return true;
    }

    /**
     * Validate that the pid being claimed for the calling app is not spoofed
     *
     * @throws SecurityException if the attribution source cannot be trusted to be from the caller.
     * @hide
     */
    @TestApi
    public void enforceCallingPid() {
        if (!checkCallingPid()) {
            throw new SecurityException("Calling pid: " + Binder.getCallingPid()
                    + " doesn't match source pid: " + mAttributionSourceState.pid);
        }
    }

    /**
     * Validate that the pid being claimed for the calling app is not spoofed
     *
     * @return if the attribution source cannot be trusted to be from the caller.
     */
    private boolean checkCallingPid() {
        final int callingPid = Binder.getCallingPid();
        if (mAttributionSourceState.pid != -1 && callingPid != mAttributionSourceState.pid) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        if (Build.IS_DEBUGGABLE) {
+6 −4
Original line number Diff line number Diff line
@@ -739,7 +739,7 @@ public class LauncherApps {
     * {@link #startMainActivity(ComponentName, UserHandle, Rect, Bundle)}.
     *
     * @param component The ComponentName of the activity to launch
     * @param startActivityOptions Options to pass to startActivity
     * @param startActivityOptions This parameter is no longer supported
     * @param user The UserHandle of the profile
     * @hide
     */
@@ -751,7 +751,8 @@ public class LauncherApps {
            Log.i(TAG, "GetMainActivityLaunchIntent " + component + " " + user);
        }
        try {
            return mService.getActivityLaunchIntent(component, startActivityOptions, user);
            // due to b/209607104, startActivityOptions will be ignored
            return mService.getActivityLaunchIntent(component, null /* opts */, user);
        } catch (RemoteException re) {
            throw re.rethrowFromSystemServer();
        }
@@ -846,7 +847,7 @@ public class LauncherApps {
     *
     * @param packageName The packageName of the shortcut
     * @param shortcutId The id of the shortcut
     * @param opts Options to pass to the PendingIntent
     * @param opts This parameter is no longer supported
     * @param user The UserHandle of the profile
     */
    @Nullable
@@ -858,8 +859,9 @@ public class LauncherApps {
            Log.i(TAG, "GetShortcutIntent " + packageName + "/" + shortcutId + " " + user);
        }
        try {
            // due to b/209607104, opts will be ignored
            return mService.getShortcutIntent(
                    mContext.getPackageName(), packageName, shortcutId, opts, user);
                    mContext.getPackageName(), packageName, shortcutId, null /* opts */, user);
        } catch (RemoteException re) {
            throw re.rethrowFromSystemServer();
        }
+3 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ public class AdbManager {
     *
     * @hide
     */
    @RequiresPermission(android.Manifest.permission.MANAGE_DEBUGGING)
    public static final String WIRELESS_DEBUG_STATE_CHANGED_ACTION =
            "com.android.server.adb.WIRELESS_DEBUG_STATUS";

@@ -46,6 +47,7 @@ public class AdbManager {
     *
     * @hide
     */
    @RequiresPermission(android.Manifest.permission.MANAGE_DEBUGGING)
    public static final String WIRELESS_DEBUG_PAIRED_DEVICES_ACTION =
            "com.android.server.adb.WIRELESS_DEBUG_PAIRED_DEVICES";

@@ -59,6 +61,7 @@ public class AdbManager {
     *
     * @hide
     */
    @RequiresPermission(android.Manifest.permission.MANAGE_DEBUGGING)
    public static final String WIRELESS_DEBUG_PAIRING_RESULT_ACTION =
            "com.android.server.adb.WIRELESS_DEBUG_PAIRING_RESULT";

+4 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.internal.app;

import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;

import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
@@ -27,6 +29,7 @@ import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.android.internal.R;

/**
@@ -48,6 +51,7 @@ public class HarmfulAppWarningActivity extends AlertActivity implements
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        getWindow().addSystemFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
        final Intent intent = getIntent();
        mPackageName = intent.getStringExtra(Intent.EXTRA_PACKAGE_NAME);
        mTarget = intent.getParcelableExtra(Intent.EXTRA_INTENT);
Loading