use of com.android.launcher3.util.PackageUserKey in project android_packages_apps_Launcher3 by crdroidandroid.
the class WidgetsBottomSheet method onWidgetsBound.
@Override
public void onWidgetsBound() {
List<WidgetItem> widgets = mActivityContext.getPopupDataProvider().getWidgetsForPackageUser(new PackageUserKey(mOriginalItemInfo.getTargetComponent().getPackageName(), mOriginalItemInfo.user));
TableLayout widgetsTable = findViewById(R.id.widgets_table);
widgetsTable.removeAllViews();
WidgetsTableUtils.groupWidgetItemsIntoTable(widgets, mMaxHorizontalSpan).forEach(row -> {
TableRow tableRow = new TableRow(getContext());
tableRow.setGravity(Gravity.TOP);
row.forEach(widgetItem -> {
WidgetCell widget = addItemCell(tableRow);
widget.setPreviewSize(widgetItem);
widget.applyFromCellItem(widgetItem, LauncherAppState.getInstance(mActivityContext).getWidgetCache());
widget.ensurePreview();
widget.setVisibility(View.VISIBLE);
});
widgetsTable.addView(tableRow);
});
}
use of com.android.launcher3.util.PackageUserKey in project android_packages_apps_Launcher3 by crdroidandroid.
the class PopupDataProvider method onNotificationPosted.
@Override
public void onNotificationPosted(PackageUserKey postedPackageUserKey, NotificationKeyData notificationKey) {
DotInfo dotInfo = mPackageUserToDotInfos.get(postedPackageUserKey);
if (dotInfo == null) {
dotInfo = new DotInfo();
mPackageUserToDotInfos.put(postedPackageUserKey, dotInfo);
}
if (dotInfo.addOrUpdateNotificationKey(notificationKey)) {
updateNotificationDots(postedPackageUserKey::equals);
}
}
use of com.android.launcher3.util.PackageUserKey in project android_packages_apps_Launcher3 by crdroidandroid.
the class InstallSessionTracker method onFinished.
@Override
public void onFinished(int sessionId, boolean success) {
// For a finished session, we can't get the session info. So use the
// packageName from our local cache.
SparseArray<PackageUserKey> activeSessions = getActiveSessionMap();
PackageUserKey key = activeSessions.get(sessionId);
activeSessions.remove(sessionId);
if (key != null && key.mPackageName != null) {
String packageName = key.mPackageName;
PackageInstallInfo info = PackageInstallInfo.fromState(success ? STATUS_INSTALLED : STATUS_FAILED, packageName, key.mUser);
mCallback.onPackageStateChanged(info);
if (!success && mInstallerCompat.promiseIconAddedForId(sessionId)) {
mCallback.onSessionFailure(packageName, key.mUser);
// If it is successful, the id is removed in the the package added flow.
mInstallerCompat.removePromiseIconId(sessionId);
}
}
}
use of com.android.launcher3.util.PackageUserKey in project android_packages_apps_Launcher3 by crdroidandroid.
the class InstallSessionTracker method pushSessionDisplayToLauncher.
private SessionInfo pushSessionDisplayToLauncher(int sessionId) {
SessionInfo session = mInstallerCompat.getVerifiedSessionInfo(sessionId);
if (session != null && session.getAppPackageName() != null) {
PackageUserKey key = new PackageUserKey(session.getAppPackageName(), getUserHandle(session));
getActiveSessionMap().put(session.getSessionId(), key);
mCallback.onUpdateSessionDisplay(key, session);
return session;
}
return null;
}
use of com.android.launcher3.util.PackageUserKey in project android_packages_apps_Launcher3 by crdroidandroid.
the class SdCardAvailableReceiver method onReceive.
@Override
public void onReceive(Context context, Intent intent) {
final LauncherApps launcherApps = context.getSystemService(LauncherApps.class);
final PackageManagerHelper pmHelper = new PackageManagerHelper(context);
for (PackageUserKey puk : mPackages) {
UserHandle user = puk.mUser;
final ArrayList<String> packagesRemoved = new ArrayList<>();
final ArrayList<String> packagesUnavailable = new ArrayList<>();
if (!launcherApps.isPackageEnabled(puk.mPackageName, user)) {
if (pmHelper.isAppOnSdcard(puk.mPackageName, user)) {
packagesUnavailable.add(puk.mPackageName);
} else {
packagesRemoved.add(puk.mPackageName);
}
}
if (!packagesRemoved.isEmpty()) {
mModel.onPackagesRemoved(user, packagesRemoved.toArray(new String[packagesRemoved.size()]));
}
if (!packagesUnavailable.isEmpty()) {
mModel.onPackagesUnavailable(packagesUnavailable.toArray(new String[packagesUnavailable.size()]), user, false);
}
}
// Unregister the broadcast receiver, just in case
mContext.unregisterReceiver(this);
}
Aggregations