use of android.content.om.OverlayInfo in project android_frameworks_base by ResurrectionRemix.
the class OverlayManagerServiceImpl method updateAllOverlaysForTarget.
private void updateAllOverlaysForTarget(@NonNull final String packageName, final int userId, @Nullable final PackageInfo targetPackage) {
final List<OverlayInfo> ois = mSettings.getOverlaysForTarget(packageName, userId);
for (final OverlayInfo oi : ois) {
final PackageInfo overlayPackage = mPackageManager.getPackageInfo(oi.packageName, userId);
if (overlayPackage == null) {
mSettings.remove(oi.packageName, oi.userId);
removeIdmapIfPossible(oi);
} else {
try {
updateState(targetPackage, overlayPackage, userId);
} catch (OverlayManagerSettings.BadKeyException e) {
Slog.e(TAG, "failed to update settings", e);
mSettings.remove(oi.packageName, userId);
}
}
}
}
use of android.content.om.OverlayInfo in project android_frameworks_base by ResurrectionRemix.
the class OverlayManagerServiceImpl method removeIdmapIfPossible.
private void removeIdmapIfPossible(@NonNull final OverlayInfo oi) {
if (!mIdmapManager.idmapExists(oi)) {
return;
}
final List<Integer> userIds = mSettings.getUsers();
for (final int userId : userIds) {
try {
final OverlayInfo tmp = mSettings.getOverlayInfo(oi.packageName, userId);
if (tmp != null && tmp.isEnabled()) {
// someone is still using the idmap file -> we cannot remove it
return;
}
} catch (OverlayManagerSettings.BadKeyException e) {
// intentionally left empty
}
}
mIdmapManager.removeIdmap(oi, oi.userId);
}
use of android.content.om.OverlayInfo in project android_frameworks_base by ResurrectionRemix.
the class OverlayManagerServiceImpl method onSetEnabled.
boolean onSetEnabled(@NonNull final String packageName, final boolean enable, final int userId, final boolean shouldWait) {
if (DEBUG) {
Slog.d(TAG, String.format("onSetEnabled packageName=%s enable=%s userId=%d", packageName, enable, userId));
}
final PackageInfo overlayPackage = mPackageManager.getPackageInfo(packageName, userId);
if (overlayPackage == null) {
return false;
}
try {
final OverlayInfo oi = mSettings.getOverlayInfo(packageName, userId);
final PackageInfo targetPackage = mPackageManager.getPackageInfo(oi.targetPackageName, userId);
mSettings.setEnabled(packageName, userId, enable);
updateState(targetPackage, overlayPackage, userId, shouldWait);
return true;
} catch (OverlayManagerSettings.BadKeyException e) {
return false;
}
}
use of android.content.om.OverlayInfo in project android_frameworks_base by DirtyUnicorns.
the class ActivityManagerService method disableOverlays.
public final void disableOverlays() {
try {
IOverlayManager iom = IOverlayManager.Stub.asInterface(ServiceManager.getService("overlay"));
if (iom == null) {
return;
}
Log.d(TAG, "Contacting the Overlay Manager Service for the list of enabled overlays");
Map<String, List<OverlayInfo>> allOverlays = iom.getAllOverlays(UserHandle.USER_SYSTEM);
if (allOverlays != null) {
Log.d(TAG, "The Overlay Manager Service provided the list of enabled overlays");
Set<String> set = allOverlays.keySet();
for (String targetPackageName : set) {
for (OverlayInfo oi : allOverlays.get(targetPackageName)) {
if (oi.isEnabled()) {
iom.setEnabled(oi.packageName, false, UserHandle.USER_SYSTEM, false);
Log.d(TAG, "Now disabling \'" + oi.packageName + "\'");
}
}
}
}
} catch (RemoteException re) {
re.printStackTrace();
Log.d(TAG, "RemoteException while trying to contact the Overlay Manager Service!");
}
}
use of android.content.om.OverlayInfo in project android_frameworks_base by AOSPA.
the class OverlayManagerServiceImpl method onGetEnabledOverlayPaths.
List<String> onGetEnabledOverlayPaths(@NonNull final String targetPackageName, final int userId) {
final List<OverlayInfo> overlays = mSettings.getOverlaysForTarget(targetPackageName, userId);
final List<String> paths = new ArrayList<>(overlays.size());
for (final OverlayInfo oi : overlays) {
if (oi.isEnabled()) {
paths.add(oi.baseCodePath);
}
}
return paths;
}
Aggregations