Add support for retrieving the Debuggable flag.

Adds support for retrieving the debuggable flag through the IPackageManagerNative interface.

Bug: 136069189
Test: Builds, verified applications debuggable flag is returned properly
Change-Id: I3c9de1e3c9de69f930508be1866c2a24e1811ceb
This commit is contained in:
Anh Pham
2021-02-08 13:36:02 +01:00
parent 6bf734ea78
commit f437e35728

View File

@@ -193,7 +193,6 @@ import android.content.pm.InstrumentationInfo;
import android.content.pm.IntentFilterVerificationInfo;
import android.content.pm.KeySet;
import android.content.pm.ModuleInfo;
import android.content.pm.overlay.OverlayPaths;
import android.content.pm.PackageChangeEvent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageInfoLite;
@@ -25916,6 +25915,17 @@ public class PackageManagerService extends IPackageManager.Stub
throw new RemoteException("Couldn't get targetSdkVersion for package " + packageName);
}
@Override
public boolean isPackageDebuggable(String packageName) throws RemoteException {
int callingUser = UserHandle.getCallingUserId();
ApplicationInfo appInfo = getApplicationInfo(packageName, 0, callingUser);
if (appInfo != null) {
return (0 != (appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE));
}
throw new RemoteException("Couldn't get debug flag for package " + packageName);
}
@Override
public boolean[] isAudioPlaybackCaptureAllowed(String[] packageNames)
throws RemoteException {