Search in sources :

Example 1 with OverlayInfo

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);
            }
        }
    }
}
Also used : PackageInfo(android.content.pm.PackageInfo) OverlayInfo(android.content.om.OverlayInfo)

Example 2 with OverlayInfo

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);
}
Also used : OverlayInfo(android.content.om.OverlayInfo)

Example 3 with OverlayInfo

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;
    }
}
Also used : PackageInfo(android.content.pm.PackageInfo) OverlayInfo(android.content.om.OverlayInfo)

Example 4 with OverlayInfo

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!");
    }
}
Also used : OverlayInfo(android.content.om.OverlayInfo) IOverlayManager(android.content.om.IOverlayManager) RemoteCallbackList(android.os.RemoteCallbackList) ArrayList(java.util.ArrayList) List(java.util.List) LocaleList(android.os.LocaleList) RemoteException(android.os.RemoteException)

Example 5 with OverlayInfo

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;
}
Also used : OverlayInfo(android.content.om.OverlayInfo) ArrayList(java.util.ArrayList)

Aggregations

OverlayInfo (android.content.om.OverlayInfo)41 PackageInfo (android.content.pm.PackageInfo)12 ArrayList (java.util.ArrayList)9 List (java.util.List)5 ArrayMap (android.util.ArrayMap)4 ArraySet (android.util.ArraySet)4 IOverlayManager (android.content.om.IOverlayManager)1 LocaleList (android.os.LocaleList)1 RemoteCallbackList (android.os.RemoteCallbackList)1 RemoteException (android.os.RemoteException)1