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

Commit 2434b922 authored by Svet Ganov's avatar Svet Ganov Committed by Automerger Merge Worker
Browse files

Addressing comments from commit:8d2ed5 am: 7d058d62

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14037325

Change-Id: Icdd2a654130cd7d0d12c0bc30d4e654078a14b69
parents 655f5969 7d058d62
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -10684,7 +10684,7 @@ package android.content {
    ctor public ContextParams.Builder(@NonNull android.content.ContextParams);
    method @NonNull public android.content.ContextParams build();
    method @NonNull public android.content.ContextParams.Builder setAttributionTag(@Nullable String);
    method @NonNull public android.content.ContextParams.Builder setNextAttributionSource(@NonNull android.content.AttributionSource);
    method @NonNull public android.content.ContextParams.Builder setNextAttributionSource(@Nullable android.content.AttributionSource);
  }
  public class ContextWrapper extends android.content.Context {
+1 −1
Original line number Diff line number Diff line
@@ -2315,7 +2315,7 @@ package android.content {
  }
  public static final class ContextParams.Builder {
    method @NonNull @RequiresPermission(android.Manifest.permission.RENOUNCE_PERMISSIONS) public android.content.ContextParams.Builder setRenouncedPermissions(@NonNull java.util.Set<java.lang.String>);
    method @NonNull @RequiresPermission(android.Manifest.permission.RENOUNCE_PERMISSIONS) public android.content.ContextParams.Builder setRenouncedPermissions(@Nullable java.util.Set<java.lang.String>);
  }
  public class ContextWrapper extends android.content.Context {
+26 −0
Original line number Diff line number Diff line
@@ -7403,6 +7403,32 @@ public class AppOpsManager {
        return sOpToString[opCode];
    }

    /**
     * Resolves special UID's pakcages such as root, shell, media, etc.
     *
     * @param uid The uid to resolve.
     * @param packageName Optional package. If caller system  and null returns "android"
     * @return The resolved package name.
     *
     * @hide
     */
    public static @Nullable String resolvePackageName(int uid, @Nullable String packageName)  {
        if (uid == Process.ROOT_UID) {
            return "root";
        } else if (uid == Process.SHELL_UID) {
            return "com.android.shell";
        } else if (uid == Process.MEDIA_UID) {
            return "media";
        } else if (uid == Process.AUDIOSERVER_UID) {
            return "audioserver";
        } else if (uid == Process.CAMERASERVER_UID) {
            return "cameraserver";
        } else if (uid == Process.SYSTEM_UID && packageName == null) {
            return "android";
        }
        return packageName;
    }

    /**
     * Monitor for changes to the operating mode for the given op in the given app package.
     * You can watch op changes only for your UID.
+9 −8
Original line number Diff line number Diff line
@@ -226,7 +226,7 @@ class ContextImpl extends Context {
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
    private final String mOpPackageName;
    private final @NonNull ContextParams mParams;
    private @NonNull AttributionSource mAttributionSource;
    private final @NonNull AttributionSource mAttributionSource;

    private final @NonNull ResourcesManager mResourcesManager;
    @UnsupportedAppUsage
@@ -3074,25 +3074,26 @@ class ContextImpl extends Context {

        mOpPackageName = overrideOpPackageName != null ? overrideOpPackageName : opPackageName;
        mParams = Objects.requireNonNull(params);
        initializeAttributionSource(attributionTag, nextAttributionSource);
        mAttributionSource = createAttributionSource(attributionTag, nextAttributionSource);
        mContentResolver = new ApplicationContentResolver(this, mainThread);
    }

    private void initializeAttributionSource(@Nullable String attributionTag,
    private @NonNull AttributionSource createAttributionSource(@Nullable String attributionTag,
            @Nullable AttributionSource nextAttributionSource) {
        mAttributionSource = new AttributionSource(Process.myUid(), mOpPackageName,
        AttributionSource attributionSource = new AttributionSource(Process.myUid(), mOpPackageName,
                attributionTag, nextAttributionSource);
        // If we want to access protected data on behalf of another app we need to
        // tell the OS that we opt in to participate in the attribution chain.
        if (nextAttributionSource != null) {
            // If an app happened to stub the internal OS for testing the registration method
            // can return null. In this case we keep the current untrusted attribution source.
            final AttributionSource attributionSource = getSystemService(PermissionManager.class)
                    .registerAttributionSource(mAttributionSource);
            if (attributionSource != null) {
                mAttributionSource = attributionSource;
            final AttributionSource registeredAttributionSource = getSystemService(
                    PermissionManager.class).registerAttributionSource(attributionSource);
            if (registeredAttributionSource != null) {
                return registeredAttributionSource;
            }
        }
        return attributionSource;
    }

    void setResources(Resources r) {
+1 −0
Original line number Diff line number Diff line
@@ -3884,6 +3884,7 @@ public abstract class ContentResolver implements ContentInterface {
    @UnsupportedAppUsage
    private final Context mContext;

    @Deprecated
    @UnsupportedAppUsage
    final String mPackageName;
    final int mTargetSdkVersion;
Loading