Search in sources :

Example 16 with ParceledListSlice

use of android.content.pm.ParceledListSlice in project android_frameworks_base by AOSPA.

the class PackageInstallerService method getAllSessions.

@Override
public ParceledListSlice<SessionInfo> getAllSessions(int userId) {
    mPm.enforceCrossUserPermission(Binder.getCallingUid(), userId, true, false, "getAllSessions");
    final List<SessionInfo> result = new ArrayList<>();
    synchronized (mSessions) {
        for (int i = 0; i < mSessions.size(); i++) {
            final PackageInstallerSession session = mSessions.valueAt(i);
            if (session.userId == userId) {
                result.add(session.generateInfo());
            }
        }
    }
    return new ParceledListSlice<>(result);
}
Also used : IPackageInstallerSession(android.content.pm.IPackageInstallerSession) ArrayList(java.util.ArrayList) SessionInfo(android.content.pm.PackageInstaller.SessionInfo) ParceledListSlice(android.content.pm.ParceledListSlice)

Example 17 with ParceledListSlice

use of android.content.pm.ParceledListSlice in project android_packages_apps_Settings by omnirom.

the class ZenAccessSettings method getPackagesRequestingNotificationPolicyAccess.

private ArraySet<String> getPackagesRequestingNotificationPolicyAccess() {
    ArraySet<String> requestingPackages = new ArraySet<>();
    try {
        final String[] PERM = { android.Manifest.permission.ACCESS_NOTIFICATION_POLICY };
        final ParceledListSlice list = AppGlobals.getPackageManager().getPackagesHoldingPermissions(PERM, 0, /*flags*/
        ActivityManager.getCurrentUser());
        final List<PackageInfo> pkgs = list.getList();
        if (pkgs != null) {
            for (PackageInfo info : pkgs) {
                requestingPackages.add(info.packageName);
            }
        }
    } catch (RemoteException e) {
        Log.e(TAG, "Cannot reach packagemanager", e);
    }
    return requestingPackages;
}
Also used : ArraySet(android.util.ArraySet) PackageInfo(android.content.pm.PackageInfo) RemoteException(android.os.RemoteException) ParceledListSlice(android.content.pm.ParceledListSlice)

Example 18 with ParceledListSlice

use of android.content.pm.ParceledListSlice in project android_packages_apps_Settings by crdroidandroid.

the class ZenAccessSettings method getPackagesRequestingNotificationPolicyAccess.

private ArraySet<String> getPackagesRequestingNotificationPolicyAccess() {
    ArraySet<String> requestingPackages = new ArraySet<>();
    try {
        final String[] PERM = { android.Manifest.permission.ACCESS_NOTIFICATION_POLICY };
        final ParceledListSlice list = AppGlobals.getPackageManager().getPackagesHoldingPermissions(PERM, 0, /*flags*/
        ActivityManager.getCurrentUser());
        final List<PackageInfo> pkgs = list.getList();
        if (pkgs != null) {
            for (PackageInfo info : pkgs) {
                requestingPackages.add(info.packageName);
            }
        }
    } catch (RemoteException e) {
        Log.e(TAG, "Cannot reach packagemanager", e);
    }
    return requestingPackages;
}
Also used : ArraySet(android.util.ArraySet) PackageInfo(android.content.pm.PackageInfo) RemoteException(android.os.RemoteException) ParceledListSlice(android.content.pm.ParceledListSlice)

Example 19 with ParceledListSlice

use of android.content.pm.ParceledListSlice in project android_packages_apps_Settings by SudaMod.

the class ZenAccessSettings method getPackagesRequestingNotificationPolicyAccess.

private ArraySet<String> getPackagesRequestingNotificationPolicyAccess() {
    ArraySet<String> requestingPackages = new ArraySet<>();
    try {
        final String[] PERM = { android.Manifest.permission.ACCESS_NOTIFICATION_POLICY };
        final ParceledListSlice list = AppGlobals.getPackageManager().getPackagesHoldingPermissions(PERM, 0, /*flags*/
        ActivityManager.getCurrentUser());
        final List<PackageInfo> pkgs = list.getList();
        if (pkgs != null) {
            for (PackageInfo info : pkgs) {
                requestingPackages.add(info.packageName);
            }
        }
    } catch (RemoteException e) {
        Log.e(TAG, "Cannot reach packagemanager", e);
    }
    return requestingPackages;
}
Also used : ArraySet(android.util.ArraySet) PackageInfo(android.content.pm.PackageInfo) RemoteException(android.os.RemoteException) ParceledListSlice(android.content.pm.ParceledListSlice)

Example 20 with ParceledListSlice

use of android.content.pm.ParceledListSlice in project android_packages_apps_Settings by DirtyUnicorns.

the class ZenAccessSettings method getPackagesRequestingNotificationPolicyAccess.

private ArraySet<String> getPackagesRequestingNotificationPolicyAccess() {
    ArraySet<String> requestingPackages = new ArraySet<>();
    try {
        final String[] PERM = { android.Manifest.permission.ACCESS_NOTIFICATION_POLICY };
        final ParceledListSlice list = AppGlobals.getPackageManager().getPackagesHoldingPermissions(PERM, 0, /*flags*/
        ActivityManager.getCurrentUser());
        final List<PackageInfo> pkgs = list.getList();
        if (pkgs != null) {
            for (PackageInfo info : pkgs) {
                requestingPackages.add(info.packageName);
            }
        }
    } catch (RemoteException e) {
        Log.e(TAG, "Cannot reach packagemanager", e);
    }
    return requestingPackages;
}
Also used : ArraySet(android.util.ArraySet) PackageInfo(android.content.pm.PackageInfo) RemoteException(android.os.RemoteException) ParceledListSlice(android.content.pm.ParceledListSlice)

Aggregations

ParceledListSlice (android.content.pm.ParceledListSlice)43 ArrayList (java.util.ArrayList)24 Point (android.graphics.Point)16 IPackageInstallerSession (android.content.pm.IPackageInstallerSession)10 PackageInfo (android.content.pm.PackageInfo)10 SessionInfo (android.content.pm.PackageInstaller.SessionInfo)10 RemoteException (android.os.RemoteException)9 PackageParser (android.content.pm.PackageParser)7 ArraySet (android.util.ArraySet)7 AppWidgetProviderInfo (android.appwidget.AppWidgetProviderInfo)5 PendingHostUpdate (android.appwidget.PendingHostUpdate)5 LongSparseArray (android.util.LongSparseArray)5 IAppWidgetHost (com.android.internal.appwidget.IAppWidgetHost)5 WidgetBackupProvider (com.android.server.WidgetBackupProvider)5 NonNull (android.annotation.NonNull)4 ActivityManager (android.app.ActivityManager)2 ApplicationInfo (android.content.pm.ApplicationInfo)2 EphemeralApplicationInfo (android.content.pm.EphemeralApplicationInfo)2 FeatureInfo (android.content.pm.FeatureInfo)2 IPackageManager (android.content.pm.IPackageManager)2