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

Commit d6c0f55c authored by Sarup Dalwani's avatar Sarup Dalwani Committed by Automerger Merge Worker
Browse files

Merge "Moving permission and flag changes out of root identity for AppCloning...

Merge "Moving permission and flag changes out of root identity for AppCloning IntentRedirection" into udc-dev am: cbcb5f8c

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



Change-Id: Ibbb02e752903e5b2057424ea7306998a67e5fac7
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 0bf66292 cbcb5f8c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -525,6 +525,8 @@ applications that come with the platform
        <permission name="android.permission.USE_ATTESTATION_VERIFICATION_SERVICE" />
        <!-- Permission required for GTS test - GtsCredentialsTestCases -->
        <permission name="android.permission.LAUNCH_CREDENTIAL_SELECTOR"/>
        <!-- Permission required for CTS test IntentRedirectionTest -->
        <permission name="android.permission.QUERY_CLONED_APPS"/>
    </privapp-permissions>

    <privapp-permissions package="com.android.statementservice">
+2 −0
Original line number Diff line number Diff line
@@ -837,6 +837,8 @@
    <uses-permission android:name="android.permission.USE_ATTESTATION_VERIFICATION_SERVICE" />
    <!-- Permission required for GTS test - GtsCredentialsTestCases -->
    <uses-permission android:name="android.permission.LAUNCH_CREDENTIAL_SELECTOR" />
    <!-- Permission required for CTS test IntentRedirectionTest -->
    <uses-permission android:name="android.permission.QUERY_CLONED_APPS" />

    <application
        android:label="@string/app_label"
+15 −7
Original line number Diff line number Diff line
@@ -60,15 +60,9 @@ public class NoFilteringResolver extends CrossProfileResolver {
    public static boolean isIntentRedirectionAllowed(Context context,
            AppCloningDeviceConfigHelper appCloningDeviceConfigHelper, boolean resolveForStart,
            long flags) {
        final long token = Binder.clearCallingIdentity();
        try {
            return  context.getResources().getBoolean(R.bool.config_enableAppCloningBuildingBlocks)
                    && appCloningDeviceConfigHelper.getEnableAppCloningBuildingBlocks()
        return isAppCloningBuildingBlocksEnabled(context, appCloningDeviceConfigHelper)
                    && (resolveForStart || (((flags & PackageManager.MATCH_CLONE_PROFILE) != 0)
                    && hasPermission(context, Manifest.permission.QUERY_CLONED_APPS)));
        } finally {
            Binder.restoreCallingIdentity(token);
        }
    }

    public NoFilteringResolver(ComponentResolverApi componentResolver,
@@ -146,4 +140,18 @@ public class NoFilteringResolver extends CrossProfileResolver {
        return context.checkCallingOrSelfPermission(permission)
                == PackageManager.PERMISSION_GRANTED;
    }

    /**
     * Checks if the AppCloningBuildingBlocks flag is enabled.
     */
    private static boolean isAppCloningBuildingBlocksEnabled(Context context,
            AppCloningDeviceConfigHelper appCloningDeviceConfigHelper) {
        final long token = Binder.clearCallingIdentity();
        try {
            return context.getResources().getBoolean(R.bool.config_enableAppCloningBuildingBlocks)
                    && appCloningDeviceConfigHelper.getEnableAppCloningBuildingBlocks();
        } finally {
            Binder.restoreCallingIdentity(token);
        }
    }
}