mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 18:58:19 +00:00
Removing static reference of deep shortcut manager
Bug: 141376165 Change-Id: Ie60b82be63a8926825598c681d8b2a1b2ace6413
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.launcher3;
|
||||
|
||||
import static com.android.launcher3.model.WidgetsModel.GO_DISABLE_WIDGETS;
|
||||
import static com.android.launcher3.util.SystemUiController.UI_STATE_OVERVIEW;
|
||||
|
||||
import static java.lang.annotation.RetentionPolicy.SOURCE;
|
||||
@@ -24,7 +25,12 @@ import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.LauncherApps;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserHandle;
|
||||
import android.util.Log;
|
||||
import android.view.ContextThemeWrapper;
|
||||
|
||||
import androidx.annotation.IntDef;
|
||||
@@ -47,6 +53,8 @@ import java.util.ArrayList;
|
||||
public abstract class BaseActivity extends Activity
|
||||
implements UserEventDelegate, LogStateProvider, ActivityContext {
|
||||
|
||||
private static final String TAG = "BaseActivity";
|
||||
|
||||
public static final int INVISIBLE_BY_STATE_HANDLER = 1 << 0;
|
||||
public static final int INVISIBLE_BY_APP_TRANSITIONS = 1 << 1;
|
||||
public static final int INVISIBLE_BY_PENDING_FLAGS = 1 << 2;
|
||||
@@ -312,6 +320,22 @@ public abstract class BaseActivity extends Activity
|
||||
writer.println(prefix + "mForceInvisible: " + mForceInvisible);
|
||||
}
|
||||
|
||||
/**
|
||||
* A wrapper around the platform method with Launcher specific checks
|
||||
*/
|
||||
public void startShortcut(String packageName, String id, Rect sourceBounds,
|
||||
Bundle startActivityOptions, UserHandle user) {
|
||||
if (GO_DISABLE_WIDGETS) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
getSystemService(LauncherApps.class).startShortcut(packageName, id, sourceBounds,
|
||||
startActivityOptions, user);
|
||||
} catch (SecurityException | IllegalStateException e) {
|
||||
Log.e(TAG, "Failed to start shortcut", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static <T extends BaseActivity> T fromContext(Context context) {
|
||||
if (context instanceof BaseActivity) {
|
||||
return (T) context;
|
||||
|
||||
Reference in New Issue
Block a user