use of android.content.pm.IPackageManager in project android_frameworks_base by crdroidandroid.
the class RecentTasks method cleanupProtectedComponentTasksLocked.
/**
* Clear out protected tasks from the list
*/
void cleanupProtectedComponentTasksLocked(int userId) {
int recentsCount = size();
if (recentsCount == 0) {
// or just any empty list.
return;
}
final IPackageManager pm = AppGlobals.getPackageManager();
for (int i = recentsCount - 1; i >= 0; i--) {
final TaskRecord task = get(i);
if (userId != UserHandle.USER_ALL && task.userId != userId) {
// Only look at tasks for the user ID of interest.
continue;
}
try {
if (task.realActivity != null && pm.isComponentProtected(null, -1, task.realActivity, userId)) {
remove(i);
task.removedFromRecents();
}
} catch (RemoteException e) {
}
}
}
use of android.content.pm.IPackageManager in project android_frameworks_base by crdroidandroid.
the class RetailDemoModeService method isDemoLauncherDisabled.
boolean isDemoLauncherDisabled() {
int enabledState = PackageManager.COMPONENT_ENABLED_STATE_DEFAULT;
try {
final IPackageManager iPm = AppGlobals.getPackageManager();
final String demoLauncherComponent = getContext().getString(R.string.config_demoModeLauncherComponent);
enabledState = iPm.getComponentEnabledSetting(ComponentName.unflattenFromString(demoLauncherComponent), mCurrentUserId);
} catch (RemoteException re) {
Slog.e(TAG, "Error retrieving demo launcher enabled setting", re);
}
return enabledState == PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
}
use of android.content.pm.IPackageManager in project android_frameworks_base by crdroidandroid.
the class RestrictedLockUtils method checkIfUninstallBlocked.
public static EnforcedAdmin checkIfUninstallBlocked(Context context, String packageName, int userId) {
EnforcedAdmin allAppsControlDisallowedAdmin = checkIfRestrictionEnforced(context, UserManager.DISALLOW_APPS_CONTROL, userId);
if (allAppsControlDisallowedAdmin != null) {
return allAppsControlDisallowedAdmin;
}
EnforcedAdmin allAppsUninstallDisallowedAdmin = checkIfRestrictionEnforced(context, UserManager.DISALLOW_UNINSTALL_APPS, userId);
if (allAppsUninstallDisallowedAdmin != null) {
return allAppsUninstallDisallowedAdmin;
}
IPackageManager ipm = AppGlobals.getPackageManager();
try {
if (ipm.getBlockUninstallForUser(packageName, userId)) {
return getProfileOrDeviceOwner(context, userId);
}
} catch (RemoteException e) {
// Nothing to do
}
return null;
}
use of android.content.pm.IPackageManager in project android_frameworks_base by crdroidandroid.
the class AccountManagerService method checkUidPermission.
private boolean checkUidPermission(String permission, int uid, String opPackageName) {
final long identity = Binder.clearCallingIdentity();
try {
IPackageManager pm = ActivityThread.getPackageManager();
if (pm.checkUidPermission(permission, uid) != PackageManager.PERMISSION_GRANTED) {
return false;
}
final int opCode = AppOpsManager.permissionToOpCode(permission);
return (opCode == AppOpsManager.OP_NONE || mAppOpsManager.noteOpNoThrow(opCode, uid, opPackageName) == AppOpsManager.MODE_ALLOWED);
} catch (RemoteException e) {
/* ignore - local call */
} finally {
Binder.restoreCallingIdentity(identity);
}
return false;
}
use of android.content.pm.IPackageManager in project android_frameworks_base by crdroidandroid.
the class IntentFirewall method logIntent.
private static void logIntent(int intentType, Intent intent, int callerUid, String resolvedType) {
// The component shouldn't be null, but let's double check just to be safe
ComponentName cn = intent.getComponent();
String shortComponent = null;
if (cn != null) {
shortComponent = cn.flattenToShortString();
}
String callerPackages = null;
int callerPackageCount = 0;
IPackageManager pm = AppGlobals.getPackageManager();
if (pm != null) {
try {
String[] callerPackagesArray = pm.getPackagesForUid(callerUid);
if (callerPackagesArray != null) {
callerPackageCount = callerPackagesArray.length;
callerPackages = joinPackages(callerPackagesArray);
}
} catch (RemoteException ex) {
Slog.e(TAG, "Remote exception while retrieving packages", ex);
}
}
EventLogTags.writeIfwIntentMatched(intentType, shortComponent, callerUid, callerPackageCount, callerPackages, intent.getAction(), resolvedType, intent.getDataString(), intent.getFlags());
}
Aggregations