Search in sources :

Example 11 with OverlayInfo

use of android.content.om.OverlayInfo in project android_frameworks_base by DirtyUnicorns.

the class OverlayManagerServiceImpl method onOverlayPackageRemoved.

void onOverlayPackageRemoved(@NonNull final String packageName, final int userId) {
    if (DEBUG) {
        Slog.d(TAG, "onOverlayPackageRemoved packageName=" + packageName + " userId=" + userId);
    }
    try {
        final OverlayInfo oi = mSettings.getOverlayInfo(packageName, userId);
        mSettings.remove(packageName, userId);
        removeIdmapIfPossible(oi);
    } catch (OverlayManagerSettings.BadKeyException e) {
        Slog.e(TAG, "failed to remove overlay package", e);
    }
}
Also used : OverlayInfo(android.content.om.OverlayInfo)

Example 12 with OverlayInfo

use of android.content.om.OverlayInfo in project android_frameworks_base by DirtyUnicorns.

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 13 with OverlayInfo

use of android.content.om.OverlayInfo in project android_frameworks_base by DirtyUnicorns.

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 14 with OverlayInfo

use of android.content.om.OverlayInfo in project android_frameworks_base by DirtyUnicorns.

the class OverlayManagerSettings method setUpgrading.

void setUpgrading(@NonNull final String packageName, final int userId, final boolean newValue) throws BadKeyException {
    final SettingsItem item = select(packageName, userId);
    if (item == null) {
        throw new BadKeyException(packageName, userId);
    }
    if (newValue == item.isUpgrading()) {
        // nothing to do
        return;
    }
    if (newValue) {
        final OverlayInfo oi = item.getOverlayInfo();
        item.setUpgrading(true);
        item.setState(STATE_NOT_APPROVED_UNKNOWN);
        notifyOverlayRemoved(oi, false);
    } else {
        item.setUpgrading(false);
    }
    notifySettingsChanged();
}
Also used : OverlayInfo(android.content.om.OverlayInfo)

Example 15 with OverlayInfo

use of android.content.om.OverlayInfo in project android_frameworks_base by DirtyUnicorns.

the class OverlayManagerServiceImpl method onOverlayPackageUpgrading.

void onOverlayPackageUpgrading(@NonNull final String packageName, final int userId) {
    if (DEBUG) {
        Slog.d(TAG, "onOverlayPackageUpgrading packageName=" + packageName + " userId=" + userId);
    }
    try {
        final OverlayInfo oi = mSettings.getOverlayInfo(packageName, userId);
        mSettings.setUpgrading(packageName, userId, true);
        removeIdmapIfPossible(oi);
    } catch (OverlayManagerSettings.BadKeyException e) {
        Slog.e(TAG, "failed to update settings", e);
        mSettings.remove(packageName, userId);
    }
}
Also used : OverlayInfo(android.content.om.OverlayInfo)

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