Add public API to check if current app is auto-revoke exempt am: 2ac02b0d3e am: a981a1ea8f am: 97894025f7
Change-Id: I08f82c30fca5ea3fb214cf45690dfae4c4be5a0c
This commit is contained in:
@@ -12025,6 +12025,7 @@ package android.content.pm {
|
|||||||
method public boolean hasSigningCertificate(int, @NonNull byte[], int);
|
method public boolean hasSigningCertificate(int, @NonNull byte[], int);
|
||||||
method public abstract boolean hasSystemFeature(@NonNull String);
|
method public abstract boolean hasSystemFeature(@NonNull String);
|
||||||
method public abstract boolean hasSystemFeature(@NonNull String, int);
|
method public abstract boolean hasSystemFeature(@NonNull String, int);
|
||||||
|
method public boolean isAutoRevokeWhitelisted();
|
||||||
method public boolean isDefaultApplicationIcon(@NonNull android.graphics.drawable.Drawable);
|
method public boolean isDefaultApplicationIcon(@NonNull android.graphics.drawable.Drawable);
|
||||||
method public boolean isDeviceUpgrading();
|
method public boolean isDeviceUpgrading();
|
||||||
method public abstract boolean isInstantApp();
|
method public abstract boolean isInstantApp();
|
||||||
|
|||||||
@@ -3337,6 +3337,15 @@ public class ApplicationPackageManager extends PackageManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAutoRevokeWhitelisted() {
|
||||||
|
try {
|
||||||
|
return mPM.isAutoRevokeWhitelisted(mContext.getPackageName());
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
throw e.rethrowAsRuntimeException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setMimeGroup(String mimeGroup, Set<String> mimeTypes) {
|
public void setMimeGroup(String mimeGroup, Set<String> mimeTypes) {
|
||||||
try {
|
try {
|
||||||
mPM.setMimeGroup(mContext.getPackageName(), mimeGroup,
|
mPM.setMimeGroup(mContext.getPackageName(), mimeGroup,
|
||||||
|
|||||||
@@ -748,4 +748,6 @@ interface IPackageManager {
|
|||||||
void clearMimeGroup(String packageName, String group);
|
void clearMimeGroup(String packageName, String group);
|
||||||
|
|
||||||
List<String> getMimeGroup(String packageName, String group);
|
List<String> getMimeGroup(String packageName, String group);
|
||||||
|
|
||||||
|
boolean isAutoRevokeWhitelisted(String packageName);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7834,6 +7834,15 @@ public abstract class PackageManager {
|
|||||||
"sendDeviceCustomizationReadyBroadcast not implemented in subclass");
|
"sendDeviceCustomizationReadyBroadcast not implemented in subclass");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return whether this package is whitelisted from having its runtime permission be
|
||||||
|
* auto-revoked if unused for an extended period of time.
|
||||||
|
*/
|
||||||
|
public boolean isAutoRevokeWhitelisted() {
|
||||||
|
throw new UnsupportedOperationException(
|
||||||
|
"isAutoRevokeWhitelisted not implemented in subclass");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns if the provided drawable represents the default activity icon provided by the system.
|
* Returns if the provided drawable represents the default activity icon provided by the system.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ import static android.Manifest.permission.READ_EXTERNAL_STORAGE;
|
|||||||
import static android.Manifest.permission.REQUEST_DELETE_PACKAGES;
|
import static android.Manifest.permission.REQUEST_DELETE_PACKAGES;
|
||||||
import static android.Manifest.permission.SET_HARMFUL_APP_WARNINGS;
|
import static android.Manifest.permission.SET_HARMFUL_APP_WARNINGS;
|
||||||
import static android.Manifest.permission.WRITE_EXTERNAL_STORAGE;
|
import static android.Manifest.permission.WRITE_EXTERNAL_STORAGE;
|
||||||
|
import static android.app.AppOpsManager.MODE_ALLOWED;
|
||||||
|
import static android.app.AppOpsManager.MODE_IGNORED;
|
||||||
import static android.content.Intent.ACTION_MAIN;
|
import static android.content.Intent.ACTION_MAIN;
|
||||||
import static android.content.Intent.CATEGORY_DEFAULT;
|
import static android.content.Intent.CATEGORY_DEFAULT;
|
||||||
import static android.content.Intent.CATEGORY_HOME;
|
import static android.content.Intent.CATEGORY_HOME;
|
||||||
@@ -24360,6 +24362,24 @@ public class PackageManagerService extends IPackageManager.Stub
|
|||||||
mCompilerStats.deletePackageStats(pkgName);
|
mCompilerStats.deletePackageStats(pkgName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAutoRevokeWhitelisted(String packageName) {
|
||||||
|
int mode = mInjector.getAppOpsManager().checkOpNoThrow(
|
||||||
|
AppOpsManager.OP_AUTO_REVOKE_PERMISSIONS_IF_UNUSED,
|
||||||
|
Binder.getCallingUid(), packageName);
|
||||||
|
if (mode == MODE_ALLOWED) {
|
||||||
|
return false;
|
||||||
|
} else if (mode == MODE_IGNORED) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
synchronized (mLock) {
|
||||||
|
boolean manifestWhitelisted =
|
||||||
|
mPackages.get(packageName).isAllowDontAutoRevokePermmissions();
|
||||||
|
return manifestWhitelisted;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getInstallReason(String packageName, int userId) {
|
public int getInstallReason(String packageName, int userId) {
|
||||||
final int callingUid = Binder.getCallingUid();
|
final int callingUid = Binder.getCallingUid();
|
||||||
|
|||||||
Reference in New Issue
Block a user