mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 01:16:49 +00:00
Merge "Allow user to select second split app from Taskbar" into tm-qpr-dev am: d5525c3bda am: 3d0b47a5ea
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/20365694 Change-Id: I03cc7692d94a8d0aa99e2822442da6251639f190 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -91,6 +91,7 @@ import com.android.launcher3.util.SettingsCache;
|
||||
import com.android.launcher3.util.TraceHelper;
|
||||
import com.android.launcher3.util.ViewCache;
|
||||
import com.android.launcher3.views.ActivityContext;
|
||||
import com.android.quickstep.views.RecentsView;
|
||||
import com.android.systemui.shared.recents.model.Task;
|
||||
import com.android.systemui.shared.rotation.RotationButtonController;
|
||||
import com.android.systemui.shared.system.ActivityManagerWrapper;
|
||||
@@ -133,6 +134,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
private final boolean mIsUserSetupComplete;
|
||||
private final boolean mIsNavBarForceVisible;
|
||||
private final boolean mIsNavBarKidsMode;
|
||||
|
||||
private boolean mIsDestroyed = false;
|
||||
// The flag to know if the window is excluded from magnification region computation.
|
||||
private boolean mIsExcludeFromMagnificationRegion = false;
|
||||
@@ -758,42 +760,63 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
if (info.isDisabled()) {
|
||||
ItemClickHandler.handleDisabledItemClicked(info, this);
|
||||
} else {
|
||||
Intent intent = new Intent(info.getIntent())
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
try {
|
||||
if (mIsSafeModeEnabled && !PackageManagerHelper.isSystemApp(this, intent)) {
|
||||
Toast.makeText(this, R.string.safemode_shortcut_error,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
} else if (info.isPromise()) {
|
||||
TestLogging.recordEvent(
|
||||
TestProtocol.SEQUENCE_MAIN, "start: taskbarPromiseIcon");
|
||||
intent = new PackageManagerHelper(this)
|
||||
.getMarketIntent(info.getTargetPackage())
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intent);
|
||||
TaskbarUIController taskbarUIController = mControllers.uiController;
|
||||
RecentsView recents = taskbarUIController.getRecentsView();
|
||||
if (recents != null
|
||||
&& taskbarUIController.getRecentsView().isSplitSelectionActive()) {
|
||||
// If we are selecting a second app for split, launch the split tasks
|
||||
taskbarUIController.triggerSecondAppForSplit(info, info.intent, view);
|
||||
} else {
|
||||
// Else launch the selected task
|
||||
Intent intent = new Intent(info.getIntent())
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
try {
|
||||
if (mIsSafeModeEnabled && !PackageManagerHelper.isSystemApp(this, intent)) {
|
||||
Toast.makeText(this, R.string.safemode_shortcut_error,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
} else if (info.isPromise()) {
|
||||
TestLogging.recordEvent(
|
||||
TestProtocol.SEQUENCE_MAIN, "start: taskbarPromiseIcon");
|
||||
intent = new PackageManagerHelper(this)
|
||||
.getMarketIntent(info.getTargetPackage())
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intent);
|
||||
|
||||
} else if (info.itemType == Favorites.ITEM_TYPE_DEEP_SHORTCUT) {
|
||||
TestLogging.recordEvent(
|
||||
TestProtocol.SEQUENCE_MAIN, "start: taskbarDeepShortcut");
|
||||
String id = info.getDeepShortcutId();
|
||||
String packageName = intent.getPackage();
|
||||
getSystemService(LauncherApps.class)
|
||||
.startShortcut(packageName, id, null, null, info.user);
|
||||
} else {
|
||||
startItemInfoActivity(info);
|
||||
} else if (info.itemType == Favorites.ITEM_TYPE_DEEP_SHORTCUT) {
|
||||
TestLogging.recordEvent(
|
||||
TestProtocol.SEQUENCE_MAIN, "start: taskbarDeepShortcut");
|
||||
String id = info.getDeepShortcutId();
|
||||
String packageName = intent.getPackage();
|
||||
getSystemService(LauncherApps.class)
|
||||
.startShortcut(packageName, id, null, null, info.user);
|
||||
} else {
|
||||
startItemInfoActivity(info);
|
||||
}
|
||||
|
||||
mControllers.uiController.onTaskbarIconLaunched(info);
|
||||
} catch (NullPointerException
|
||||
| ActivityNotFoundException
|
||||
| SecurityException e) {
|
||||
Toast.makeText(this, R.string.activity_not_found, Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
Log.e(TAG, "Unable to launch. tag=" + info + " intent=" + intent, e);
|
||||
}
|
||||
|
||||
mControllers.uiController.onTaskbarIconLaunched(info);
|
||||
mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(true);
|
||||
} catch (NullPointerException | ActivityNotFoundException | SecurityException e) {
|
||||
Toast.makeText(this, R.string.activity_not_found, Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
Log.e(TAG, "Unable to launch. tag=" + info + " intent=" + intent, e);
|
||||
}
|
||||
mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(true);
|
||||
}
|
||||
} else if (tag instanceof AppInfo) {
|
||||
startItemInfoActivity((AppInfo) tag);
|
||||
mControllers.uiController.onTaskbarIconLaunched((AppInfo) tag);
|
||||
AppInfo info = (AppInfo) tag;
|
||||
TaskbarUIController taskbarUIController = mControllers.uiController;
|
||||
RecentsView recents = taskbarUIController.getRecentsView();
|
||||
if (recents != null
|
||||
&& taskbarUIController.getRecentsView().isSplitSelectionActive()) {
|
||||
// If we are selecting a second app for split, launch the split tasks
|
||||
taskbarUIController.triggerSecondAppForSplit(info, info.intent, view);
|
||||
} else {
|
||||
// Else launch the selected task
|
||||
startItemInfoActivity((AppInfo) tag);
|
||||
mControllers.uiController.onTaskbarIconLaunched((AppInfo) tag);
|
||||
}
|
||||
mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(true);
|
||||
} else {
|
||||
Log.e(TAG, "Unknown type clicked: " + tag);
|
||||
|
||||
Reference in New Issue
Block a user