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

Commit f0d748be authored by lpeter's avatar lpeter
Browse files

Add "conditional=true" annotation for setPackagesSuspended API.

We have the @RequiresPermission(Manifest.permission.SUSPEND_APPS)
annotation for PackageManager.setPackagesSuspended API, but we
allow the device owner and profile owner to use this API directly
without the permission "Manifest.permission.SUSPEND_APPS" in the
service implementation. So we need to add "conditional=true" to
@RequiresPermission annotation for this API.

Bug: 284455031
Test: build pass and boot success
Change-Id: I9f31f074736afd216935f4112584fef9ea98e2bf
parent 97d0644e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3907,7 +3907,7 @@ package android.content.pm {
    method @NonNull @RequiresPermission(android.Manifest.permission.SUSPEND_APPS) public String[] setDistractingPackageRestrictions(@NonNull String[], int);
    method @RequiresPermission(android.Manifest.permission.SET_HARMFUL_APP_WARNINGS) public void setHarmfulAppWarning(@NonNull String, @Nullable CharSequence);
    method @Deprecated @Nullable @RequiresPermission(android.Manifest.permission.SUSPEND_APPS) public String[] setPackagesSuspended(@Nullable String[], boolean, @Nullable android.os.PersistableBundle, @Nullable android.os.PersistableBundle, @Nullable String);
    method @Nullable @RequiresPermission(android.Manifest.permission.SUSPEND_APPS) public String[] setPackagesSuspended(@Nullable String[], boolean, @Nullable android.os.PersistableBundle, @Nullable android.os.PersistableBundle, @Nullable android.content.pm.SuspendDialogInfo);
    method @Nullable @RequiresPermission(value=android.Manifest.permission.SUSPEND_APPS, conditional=true) public String[] setPackagesSuspended(@Nullable String[], boolean, @Nullable android.os.PersistableBundle, @Nullable android.os.PersistableBundle, @Nullable android.content.pm.SuspendDialogInfo);
    method @RequiresPermission(value=android.Manifest.permission.CHANGE_COMPONENT_ENABLED_STATE, conditional=true) public void setSyntheticAppDetailsActivityEnabled(@NonNull String, boolean);
    method public void setSystemAppState(@NonNull String, int);
    method @RequiresPermission(android.Manifest.permission.INSTALL_PACKAGES) public abstract void setUpdateAvailable(@NonNull String, boolean);
+3 −2
Original line number Diff line number Diff line
@@ -9487,7 +9487,8 @@ public abstract class PackageManager {
     * {@link PersistableBundle} objects to be shared with the apps being suspended and the
     * launcher to support customization that they might need to handle the suspended state.
     *
     * <p>The caller must hold {@link Manifest.permission#SUSPEND_APPS} to use this API.
     * <p>The caller must hold {@link Manifest.permission#SUSPEND_APPS} to use this API except for
     * device owner and profile owner.
     *
     * @param packageNames The names of the packages to set the suspended status.
     * @param suspended If set to {@code true}, the packages will be suspended, if set to
@@ -9513,7 +9514,7 @@ public abstract class PackageManager {
     * @hide
     */
    @SystemApi
    @RequiresPermission(Manifest.permission.SUSPEND_APPS)
    @RequiresPermission(value=Manifest.permission.SUSPEND_APPS, conditional=true)
    @Nullable
    public String[] setPackagesSuspended(@Nullable String[] packageNames, boolean suspended,
            @Nullable PersistableBundle appExtras, @Nullable PersistableBundle launcherExtras,