Search in sources :

Example 1 with RemoteActionShortcut

use of com.android.launcher3.popup.RemoteActionShortcut in project android_packages_apps_Launcher3 by crdroidandroid.

the class WellbeingModel method getShortcutForApp.

@MainThread
private SystemShortcut getShortcutForApp(String packageName, int userId, BaseDraggingActivity activity, ItemInfo info) {
    Preconditions.assertUIThread();
    // Work profile apps are not recognized by digital wellbeing.
    if (userId != UserHandle.myUserId()) {
        if (DEBUG || mIsInTest) {
            Log.d(TAG, "getShortcutForApp [" + packageName + "]: not current user");
        }
        return null;
    }
    synchronized (mModelLock) {
        String actionId = mPackageToActionId.get(packageName);
        final RemoteAction action = actionId != null ? mActionIdMap.get(actionId) : null;
        if (action == null) {
            if (DEBUG || mIsInTest) {
                Log.d(TAG, "getShortcutForApp [" + packageName + "]: no action");
            }
            return null;
        }
        if (DEBUG || mIsInTest) {
            Log.d(TAG, "getShortcutForApp [" + packageName + "]: action: '" + action.getTitle() + "'");
        }
        return new RemoteActionShortcut(action, activity, info);
    }
}
Also used : RemoteActionShortcut(com.android.launcher3.popup.RemoteActionShortcut) RemoteAction(android.app.RemoteAction) MainThread(androidx.annotation.MainThread)

Aggregations

RemoteAction (android.app.RemoteAction)1 MainThread (androidx.annotation.MainThread)1 RemoteActionShortcut (com.android.launcher3.popup.RemoteActionShortcut)1