diff options
author | Android Build Prod User <android-build-prod@system.gserviceaccount.com> | 2021-08-24 22:06:06 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2021-08-24 22:06:06 +0000 |
commit | eae218278f58fba80324168642631995600dbfc8 (patch) | |
tree | 270d60b5bb9289a2db7f5987908e7ce8c0488aba /go | |
parent | f40413134892be151ee7aa9274109836d260f4d0 (diff) | |
parent | bb7553017c8f272040d99bbe09a312c1178b2bcb (diff) | |
download | Launcher3-eae218278f58fba80324168642631995600dbfc8.tar.gz |
Merge "Add callback to ImageActionUtils for unresolved intents"
Diffstat (limited to 'go')
-rw-r--r-- | go/quickstep/src/com/android/quickstep/TaskOverlayFactoryGo.java | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/go/quickstep/src/com/android/quickstep/TaskOverlayFactoryGo.java b/go/quickstep/src/com/android/quickstep/TaskOverlayFactoryGo.java index 6502526dcc..bc38739d57 100644 --- a/go/quickstep/src/com/android/quickstep/TaskOverlayFactoryGo.java +++ b/go/quickstep/src/com/android/quickstep/TaskOverlayFactoryGo.java @@ -50,7 +50,6 @@ import androidx.annotation.IntDef; import androidx.annotation.VisibleForTesting; import com.android.launcher3.BaseActivity; -import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.views.ArrowTipView; @@ -76,7 +75,7 @@ public final class TaskOverlayFactoryGo extends TaskOverlayFactory { public static final String ACTIONS_ERROR_CODE = "niu_actions_app_error_code"; public static final int ERROR_PERMISSIONS_STRUCTURE = 1; public static final int ERROR_PERMISSIONS_SCREENSHOT = 2; - private static final String NIU_ACTIONS_CONFIRMED = "launcher_go.niu_actions_confirmed"; + public static final String NIU_ACTIONS_CONFIRMED = "launcher_go.niu_actions_confirmed"; private static final String ASSIST_SETTINGS_ARGS_BUNDLE = ":settings:show_fragment_args"; private static final String ASSIST_SETTINGS_ARGS_KEY = ":settings:fragment_args_key"; private static final String ASSIST_SETTINGS_PREFERENCE_KEY = "default_assist"; @@ -87,10 +86,11 @@ public final class TaskOverlayFactoryGo extends TaskOverlayFactory { @Retention(SOURCE) @IntDef({PRIVACY_CONFIRMATION, ASSISTANT_NOT_SELECTED, ASSISTANT_NOT_SUPPORTED}) - private @interface DialogType{} - private static final int PRIVACY_CONFIRMATION = 0; - private static final int ASSISTANT_NOT_SELECTED = 1; - private static final int ASSISTANT_NOT_SUPPORTED = 2; + @VisibleForTesting + public @interface DialogType{} + public static final int PRIVACY_CONFIRMATION = 0; + public static final int ASSISTANT_NOT_SELECTED = 1; + public static final int ASSISTANT_NOT_SUPPORTED = 2; private AssistContentRequester mContentRequester; @@ -211,7 +211,8 @@ public final class TaskOverlayFactoryGo extends TaskOverlayFactory { Intent intent = createNIUIntent(actionType); // Only add and send the image if the appropriate permissions are held if (mAssistStructurePermitted && mAssistScreenshotPermitted) { - mImageApi.shareAsDataWithExplicitIntent(/* crop */ null, intent); + mImageApi.shareAsDataWithExplicitIntent(/* crop */ null, intent, + () -> showDialog(actionType, ASSISTANT_NOT_SUPPORTED)); } else { // If both permissions are disabled, the structure error code takes priority // The user must enable that one before they can enable screenshots @@ -301,7 +302,6 @@ public final class TaskOverlayFactoryGo extends TaskOverlayFactory { mImageApi = imageActionsApi; } - // TODO (b/192406446): Test that these dialogs are shown at the appropriate times private void showDialog(String action, @DialogType int type) { switch (type) { case PRIVACY_CONFIRMATION: @@ -334,7 +334,7 @@ public final class TaskOverlayFactoryGo extends TaskOverlayFactory { int bodyTextID, int button1TextID, View.OnClickListener button1Callback, int button2TextID, View.OnClickListener button2Callback) { - BaseDraggingActivity activity = BaseActivity.fromContext(getActionsView().getContext()); + BaseActivity activity = BaseActivity.fromContext(getActionsView().getContext()); LayoutInflater inflater = LayoutInflater.from(activity); View view = inflater.inflate(R.layout.niu_actions_dialog, /* root */ null); @@ -368,6 +368,11 @@ public final class TaskOverlayFactoryGo extends TaskOverlayFactory { mDialog.cancel(); } + @VisibleForTesting + public OverlayDialogGo getDialog() { + return mDialog; + } + private void onDialogClickSettings(View v) { mDialog.dismiss(); @@ -401,7 +406,11 @@ public final class TaskOverlayFactoryGo extends TaskOverlayFactory { } } - private static final class OverlayDialogGo extends AlertDialog { + /** + * Basic modal dialog for various user prompts + */ + @VisibleForTesting + public static final class OverlayDialogGo extends AlertDialog { private final String mAction; private final @DialogType int mType; |