Loading go/quickstep/res/values/config.xml +0 −2 Original line number Diff line number Diff line Loading @@ -16,8 +16,6 @@ <resources> <!-- The component to receive app sharing Intents --> <string name="app_sharing_component" translatable="false"/> <!-- The package to receive Listen, Translate, and Search Intents --> <string name="niu_actions_package" translatable="false"/> <!-- Feature Flags --> <bool name="enable_niu_actions">true</bool> Loading go/quickstep/src/com/android/quickstep/TaskOverlayFactoryGo.java +13 −7 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static com.android.quickstep.views.OverviewActionsView.DISABLED_ROTATED; import android.annotation.SuppressLint; import android.app.assist.AssistContent; import android.content.ActivityNotFoundException; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; Loading @@ -29,10 +30,10 @@ import android.os.SystemClock; import android.os.UserManager; import android.provider.Settings; import android.text.TextUtils; import android.util.Log; import androidx.annotation.VisibleForTesting; import com.android.launcher3.R; import com.android.quickstep.util.AssistContentRequester; import com.android.quickstep.views.OverviewActionsView; import com.android.quickstep.views.TaskThumbnailView; Loading Loading @@ -90,9 +91,7 @@ public final class TaskOverlayFactoryGo extends TaskOverlayFactory { public void initOverlay(Task task, ThumbnailData thumbnail, Matrix matrix, boolean rotated) { getActionsView().updateDisabledFlags(DISABLED_NO_THUMBNAIL, thumbnail == null); mNIUPackageName = mApplicationContext.getString(R.string.niu_actions_package); checkSettings(); if (thumbnail == null || TextUtils.isEmpty(mNIUPackageName)) { return; } Loading @@ -105,7 +104,6 @@ public final class TaskOverlayFactoryGo extends TaskOverlayFactory { getActionsView().setCallbacks(new OverlayUICallbacksGoImpl(isAllowedByPolicy, task)); mTaskPackageName = task.key.getPackageName(); checkPermissions(); if (!mAssistPermissionsEnabled) { return; } Loading Loading @@ -137,7 +135,11 @@ public final class TaskOverlayFactoryGo extends TaskOverlayFactory { mImageApi.shareAsDataWithExplicitIntent(/* crop */ null, intent); } else { intent.putExtra(ACTIONS_ERROR_CODE, ERROR_PERMISSIONS); try { mApplicationContext.startActivity(intent); } catch (ActivityNotFoundException e) { Log.e(TAG, "No activity found to receive permission error intent"); } } } Loading @@ -160,13 +162,17 @@ public final class TaskOverlayFactoryGo extends TaskOverlayFactory { * Checks whether the Assistant has screen context permissions */ @VisibleForTesting public void checkPermissions() { public void checkSettings() { ContentResolver contentResolver = mApplicationContext.getContentResolver(); boolean structureEnabled = Settings.Secure.getInt(contentResolver, Settings.Secure.ASSIST_STRUCTURE_ENABLED, 1) != 0; boolean screenshotEnabled = Settings.Secure.getInt(contentResolver, Settings.Secure.ASSIST_SCREENSHOT_ENABLED, 1) != 0; mAssistPermissionsEnabled = structureEnabled && screenshotEnabled; String assistantPackage = Settings.Secure.getString(contentResolver, Settings.Secure.ASSISTANT); mNIUPackageName = assistantPackage.split("/", 2)[0]; } protected class OverlayUICallbacksGoImpl extends OverlayUICallbacksImpl Loading quickstep/src/com/android/quickstep/util/ImageActionUtils.java +11 −5 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; import android.app.Activity; import android.app.ActivityOptions; import android.app.prediction.AppTarget; import android.content.ActivityNotFoundException; import android.content.ClipData; import android.content.ClipDescription; import android.content.ComponentName; Loading Loading @@ -68,6 +69,7 @@ public class ImageActionUtils { private static final long FILE_LIFE = 1000L /*ms*/ * 60L /*s*/ * 60L /*m*/ * 24L /*h*/; private static final String SUB_FOLDER = "Overview"; private static final String BASE_NAME = "overview_image_"; private static final String TAG = "ImageActionUtils"; /** * Saves screenshot to location determine by SystemUiProxy Loading Loading @@ -154,12 +156,16 @@ public class ImageActionUtils { Intent intent, BiFunction<Uri, Intent, Intent[]> uriToIntentMap, String tag) { Intent[] intents = uriToIntentMap.apply(getImageUri(bitmap, crop, context, tag), intent); try { // Work around b/159412574 if (intents.length == 1) { context.startActivity(intents[0]); } else { context.startActivities(intents); } } catch (ActivityNotFoundException e) { Log.e(TAG, "No activity found to receive image intent"); } } /** Loading Loading
go/quickstep/res/values/config.xml +0 −2 Original line number Diff line number Diff line Loading @@ -16,8 +16,6 @@ <resources> <!-- The component to receive app sharing Intents --> <string name="app_sharing_component" translatable="false"/> <!-- The package to receive Listen, Translate, and Search Intents --> <string name="niu_actions_package" translatable="false"/> <!-- Feature Flags --> <bool name="enable_niu_actions">true</bool> Loading
go/quickstep/src/com/android/quickstep/TaskOverlayFactoryGo.java +13 −7 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static com.android.quickstep.views.OverviewActionsView.DISABLED_ROTATED; import android.annotation.SuppressLint; import android.app.assist.AssistContent; import android.content.ActivityNotFoundException; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; Loading @@ -29,10 +30,10 @@ import android.os.SystemClock; import android.os.UserManager; import android.provider.Settings; import android.text.TextUtils; import android.util.Log; import androidx.annotation.VisibleForTesting; import com.android.launcher3.R; import com.android.quickstep.util.AssistContentRequester; import com.android.quickstep.views.OverviewActionsView; import com.android.quickstep.views.TaskThumbnailView; Loading Loading @@ -90,9 +91,7 @@ public final class TaskOverlayFactoryGo extends TaskOverlayFactory { public void initOverlay(Task task, ThumbnailData thumbnail, Matrix matrix, boolean rotated) { getActionsView().updateDisabledFlags(DISABLED_NO_THUMBNAIL, thumbnail == null); mNIUPackageName = mApplicationContext.getString(R.string.niu_actions_package); checkSettings(); if (thumbnail == null || TextUtils.isEmpty(mNIUPackageName)) { return; } Loading @@ -105,7 +104,6 @@ public final class TaskOverlayFactoryGo extends TaskOverlayFactory { getActionsView().setCallbacks(new OverlayUICallbacksGoImpl(isAllowedByPolicy, task)); mTaskPackageName = task.key.getPackageName(); checkPermissions(); if (!mAssistPermissionsEnabled) { return; } Loading Loading @@ -137,7 +135,11 @@ public final class TaskOverlayFactoryGo extends TaskOverlayFactory { mImageApi.shareAsDataWithExplicitIntent(/* crop */ null, intent); } else { intent.putExtra(ACTIONS_ERROR_CODE, ERROR_PERMISSIONS); try { mApplicationContext.startActivity(intent); } catch (ActivityNotFoundException e) { Log.e(TAG, "No activity found to receive permission error intent"); } } } Loading @@ -160,13 +162,17 @@ public final class TaskOverlayFactoryGo extends TaskOverlayFactory { * Checks whether the Assistant has screen context permissions */ @VisibleForTesting public void checkPermissions() { public void checkSettings() { ContentResolver contentResolver = mApplicationContext.getContentResolver(); boolean structureEnabled = Settings.Secure.getInt(contentResolver, Settings.Secure.ASSIST_STRUCTURE_ENABLED, 1) != 0; boolean screenshotEnabled = Settings.Secure.getInt(contentResolver, Settings.Secure.ASSIST_SCREENSHOT_ENABLED, 1) != 0; mAssistPermissionsEnabled = structureEnabled && screenshotEnabled; String assistantPackage = Settings.Secure.getString(contentResolver, Settings.Secure.ASSISTANT); mNIUPackageName = assistantPackage.split("/", 2)[0]; } protected class OverlayUICallbacksGoImpl extends OverlayUICallbacksImpl Loading
quickstep/src/com/android/quickstep/util/ImageActionUtils.java +11 −5 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; import android.app.Activity; import android.app.ActivityOptions; import android.app.prediction.AppTarget; import android.content.ActivityNotFoundException; import android.content.ClipData; import android.content.ClipDescription; import android.content.ComponentName; Loading Loading @@ -68,6 +69,7 @@ public class ImageActionUtils { private static final long FILE_LIFE = 1000L /*ms*/ * 60L /*s*/ * 60L /*m*/ * 24L /*h*/; private static final String SUB_FOLDER = "Overview"; private static final String BASE_NAME = "overview_image_"; private static final String TAG = "ImageActionUtils"; /** * Saves screenshot to location determine by SystemUiProxy Loading Loading @@ -154,12 +156,16 @@ public class ImageActionUtils { Intent intent, BiFunction<Uri, Intent, Intent[]> uriToIntentMap, String tag) { Intent[] intents = uriToIntentMap.apply(getImageUri(bitmap, crop, context, tag), intent); try { // Work around b/159412574 if (intents.length == 1) { context.startActivity(intents[0]); } else { context.startActivities(intents); } } catch (ActivityNotFoundException e) { Log.e(TAG, "No activity found to receive image intent"); } } /** Loading