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

Commit a45eba99 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Merge cherrypicks of ['googleplex-android-review.googlesource.com/30691628',...

Merge cherrypicks of ['googleplex-android-review.googlesource.com/30691628', 'googleplex-android-review.googlesource.com/31116450', 'googleplex-android-review.googlesource.com/31378480', 'googleplex-android-review.googlesource.com/31593106', 'googleplex-android-review.googlesource.com/31720928', 'googleplex-android-review.googlesource.com/31789823', 'googleplex-android-review.googlesource.com/32103083', 'googleplex-android-review.googlesource.com/32160027', 'googleplex-android-review.googlesource.com/31247040', 'googleplex-android-review.googlesource.com/31244299'] into security-aosp-udc-release.

Change-Id: I397a55edee28372f06babde5d92efe73a4033739
parents 20deaf2c c8ac5c6d
Loading
Loading
Loading
Loading
+20 −1
Original line number Diff line number Diff line
@@ -23,12 +23,13 @@ import android.os.IBinder;
import com.android.internal.util.Preconditions;

import java.util.List;
import java.util.Objects;

/**
 * Privileges granted to a Process that allows it to execute starts from the background.
 * @hide
 */
public class BackgroundStartPrivileges {
public final class BackgroundStartPrivileges {
    /** No privileges. */
    public static final BackgroundStartPrivileges NONE = new BackgroundStartPrivileges(
            false, false, null);
@@ -181,4 +182,22 @@ public class BackgroundStartPrivileges {
                + ", originatingToken=" + mOriginatingToken
                + ']';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        BackgroundStartPrivileges that = (BackgroundStartPrivileges) o;
        return mAllowsBackgroundActivityStarts == that.mAllowsBackgroundActivityStarts
                && mAllowsBackgroundForegroundServiceStarts
                == that.mAllowsBackgroundForegroundServiceStarts
                && Objects.equals(mOriginatingToken, that.mOriginatingToken);
    }

    @Override
    public int hashCode() {
        return Objects.hash(mAllowsBackgroundActivityStarts,
                mAllowsBackgroundForegroundServiceStarts,
                mOriginatingToken);
    }
}
+4 −0
Original line number Diff line number Diff line
@@ -6459,4 +6459,8 @@
    <!-- Whether the AOSP support for app cloning building blocks is to be enabled for the
         device. -->
    <bool name="config_enableAppCloningBuildingBlocks">true</bool>

    <!-- List of protected packages that require biometric authentication for modification
         (Disable, force-stop or uninstalling updates). -->
    <string-array name="config_biometric_protected_package_names" translatable="false" />
</resources>
+4 −0
Original line number Diff line number Diff line
@@ -5132,4 +5132,8 @@

  <java-symbol type="drawable" name="focus_event_pressed_key_background" />
  <java-symbol type="string" name="lockscreen_too_many_failed_attempts_countdown" />

  <!-- List of protected packages that require biometric authentication for modification -->
  <java-symbol type="array" name="config_biometric_protected_package_names" />

</resources>
+11 −0
Original line number Diff line number Diff line
@@ -119,4 +119,15 @@ public class BackgroundStartPrivilegesTest {
                Arrays.asList(BSP_ALLOW_A, BSP_ALLOW_A, BSP_ALLOW_A, BSP_ALLOW_A)))
                .isEqualTo(BSP_ALLOW_A);
    }

    @Test
    public void backgroundStartPrivilege_equals_works() {
        assertThat(NONE).isEqualTo(NONE);
        assertThat(ALLOW_BAL).isEqualTo(ALLOW_BAL);
        assertThat(ALLOW_FGS).isEqualTo(ALLOW_FGS);
        assertThat(BSP_ALLOW_A).isEqualTo(BSP_ALLOW_A);
        assertThat(NONE).isNotEqualTo(ALLOW_BAL);
        assertThat(ALLOW_FGS).isNotEqualTo(ALLOW_BAL);
        assertThat(BSP_ALLOW_A).isNotEqualTo(BSP_ALLOW_B);
    }
}
+10 −9
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageInstaller;
import android.content.pm.PackageInstaller.SessionInfo;
import android.content.pm.PackageManager;
import android.content.pm.ProviderInfo;
import android.net.Uri;
@@ -78,14 +79,14 @@ public class InstallStart extends Activity {
        // If the activity was started via a PackageInstaller session, we retrieve the calling
        // package from that session
        final int sessionId = (isSessionInstall
                ? intent.getIntExtra(PackageInstaller.EXTRA_SESSION_ID, -1)
                : -1);
        if (callingPackage == null && sessionId != -1) {
            PackageInstaller packageInstaller = getPackageManager().getPackageInstaller();
                ? intent.getIntExtra(PackageInstaller.EXTRA_SESSION_ID, SessionInfo.INVALID_ID)
                : SessionInfo.INVALID_ID);
        if (sessionId != SessionInfo.INVALID_ID) {
            PackageInstaller packageInstaller = mPackageManager.getPackageInstaller();
            PackageInstaller.SessionInfo sessionInfo = packageInstaller.getSessionInfo(sessionId);
            callingPackage = (sessionInfo != null) ? sessionInfo.getInstallerPackageName() : null;
            callingAttributionTag =
                    (sessionInfo != null) ? sessionInfo.getInstallerAttributionTag() : null;
            if (sessionInfo != null) {
                callingAttributionTag = sessionInfo.getInstallerAttributionTag();
            }
        }

        final ApplicationInfo sourceInfo = getSourceInfo(callingPackage);
@@ -233,7 +234,7 @@ public class InstallStart extends Activity {
    private ApplicationInfo getSourceInfo(@Nullable String callingPackage) {
        if (callingPackage != null) {
            try {
                return getPackageManager().getApplicationInfo(callingPackage, 0);
                return mPackageManager.getApplicationInfo(callingPackage, 0);
            } catch (PackageManager.NameNotFoundException ex) {
                // ignore
            }
@@ -242,7 +243,7 @@ public class InstallStart extends Activity {
    }

    private boolean isSystemDownloadsProvider(int uid) {
        final ProviderInfo downloadProviderPackage = getPackageManager().resolveContentProvider(
        final ProviderInfo downloadProviderPackage = mPackageManager.resolveContentProvider(
                DOWNLOADS_AUTHORITY, 0);
        if (downloadProviderPackage == null) {
            // There seems to be no currently enabled downloads provider on the system.
Loading