Loading quickstep/src/com/android/quickstep/ImageActionsApi.java +10 −8 Original line number Diff line number Diff line Loading @@ -78,16 +78,17 @@ public class ImageActionsApi { addImageAndSendIntent(crop, intent, true, exceptionCallback); } @UiThread private void addImageAndSendIntent(@Nullable Rect crop, Intent intent, boolean setData, @Nullable Runnable exceptionCallback) { if (mBitmapSupplier.get() == null) { UI_HELPER_EXECUTOR.execute(() -> { Bitmap bitmap = mBitmapSupplier.get(); if (bitmap == null) { Log.e(TAG, "No snapshot available, not starting share."); return; } UI_HELPER_EXECUTOR.execute(() -> persistBitmapAndStartActivity(mContext, mBitmapSupplier.get(), crop, intent, (uri, intentForUri) -> { persistBitmapAndStartActivity(mContext, bitmap, crop, intent, (uri, intentForUri) -> { intentForUri.addFlags(FLAG_GRANT_READ_URI_PERMISSION); if (setData) { intentForUri.setData(uri); Loading @@ -95,7 +96,8 @@ public class ImageActionsApi { intentForUri.putExtra(EXTRA_STREAM, uri); } return new Intent[]{intentForUri}; }, TAG, exceptionCallback)); }, TAG, exceptionCallback); }); } /** Loading quickstep/src/com/android/quickstep/util/ImageActionUtils.java +48 −46 Original line number Diff line number Diff line Loading @@ -43,7 +43,6 @@ import android.net.Uri; import android.util.Log; import android.view.View; import androidx.annotation.UiThread; import androidx.annotation.WorkerThread; import androidx.core.content.FileProvider; Loading Loading @@ -86,21 +85,23 @@ public class ImageActionUtils { * Launch the activity to share image for overview sharing. This is to share cropped bitmap * with specific share targets (with shortcutInfo and appTarget) rendered in overview. */ @UiThread public static void shareImage(Context context, Supplier<Bitmap> bitmapSupplier, RectF rectF, ShortcutInfo shortcutInfo, AppTarget appTarget, String tag) { if (bitmapSupplier.get() == null) { UI_HELPER_EXECUTOR.execute(() -> { Bitmap bitmap = bitmapSupplier.get(); if (bitmap == null) { return; } Rect crop = new Rect(); rectF.round(crop); Intent intent = new Intent(); Uri uri = getImageUri(bitmapSupplier.get(), crop, context, tag); Uri uri = getImageUri(bitmap, crop, context, tag); ClipData clipdata = new ClipData(new ClipDescription("content", new String[]{"image/png"}), new ClipData.Item(uri)); intent.setAction(Intent.ACTION_SEND) .setComponent(new ComponentName(appTarget.getPackageName(), appTarget.getClassName())) .setComponent( new ComponentName(appTarget.getPackageName(), appTarget.getClassName())) .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) .addFlags(FLAG_GRANT_READ_URI_PERMISSION) .setType("image/png") Loading @@ -115,38 +116,39 @@ public class ImageActionUtils { } else { context.startActivity(intent); } }); } /** * Launch the activity to share image. */ @UiThread public static void startShareActivity(Context context, Supplier<Bitmap> bitmapSupplier, Rect crop, Intent intent, String tag) { if (bitmapSupplier.get() == null) { UI_HELPER_EXECUTOR.execute(() -> { Bitmap bitmap = bitmapSupplier.get(); if (bitmap == null) { Log.e(tag, "No snapshot available, not starting share."); return; } UI_HELPER_EXECUTOR.execute(() -> persistBitmapAndStartActivity(context, bitmapSupplier.get(), crop, intent, ImageActionUtils::getShareIntentForImageUri, tag)); persistBitmapAndStartActivity(context, bitmap, crop, intent, ImageActionUtils::getShareIntentForImageUri, tag); }); } /** * Launch the activity to share image with shared element transition. */ @UiThread public static void startShareActivity(Context context, Supplier<Bitmap> bitmapSupplier, Rect crop, Intent intent, String tag, View sharedElement) { if (bitmapSupplier.get() == null) { UI_HELPER_EXECUTOR.execute(() -> { Bitmap bitmap = bitmapSupplier.get(); if (bitmap == null) { Log.e(tag, "No snapshot available, not starting share."); return; } UI_HELPER_EXECUTOR.execute(() -> persistBitmapAndStartActivity(context, bitmapSupplier.get(), crop, intent, ImageActionUtils::getShareIntentForImageUri, tag, sharedElement)); persistBitmapAndStartActivity(context, bitmap, crop, intent, ImageActionUtils::getShareIntentForImageUri, tag, sharedElement); }); } /** Loading Loading
quickstep/src/com/android/quickstep/ImageActionsApi.java +10 −8 Original line number Diff line number Diff line Loading @@ -78,16 +78,17 @@ public class ImageActionsApi { addImageAndSendIntent(crop, intent, true, exceptionCallback); } @UiThread private void addImageAndSendIntent(@Nullable Rect crop, Intent intent, boolean setData, @Nullable Runnable exceptionCallback) { if (mBitmapSupplier.get() == null) { UI_HELPER_EXECUTOR.execute(() -> { Bitmap bitmap = mBitmapSupplier.get(); if (bitmap == null) { Log.e(TAG, "No snapshot available, not starting share."); return; } UI_HELPER_EXECUTOR.execute(() -> persistBitmapAndStartActivity(mContext, mBitmapSupplier.get(), crop, intent, (uri, intentForUri) -> { persistBitmapAndStartActivity(mContext, bitmap, crop, intent, (uri, intentForUri) -> { intentForUri.addFlags(FLAG_GRANT_READ_URI_PERMISSION); if (setData) { intentForUri.setData(uri); Loading @@ -95,7 +96,8 @@ public class ImageActionsApi { intentForUri.putExtra(EXTRA_STREAM, uri); } return new Intent[]{intentForUri}; }, TAG, exceptionCallback)); }, TAG, exceptionCallback); }); } /** Loading
quickstep/src/com/android/quickstep/util/ImageActionUtils.java +48 −46 Original line number Diff line number Diff line Loading @@ -43,7 +43,6 @@ import android.net.Uri; import android.util.Log; import android.view.View; import androidx.annotation.UiThread; import androidx.annotation.WorkerThread; import androidx.core.content.FileProvider; Loading Loading @@ -86,21 +85,23 @@ public class ImageActionUtils { * Launch the activity to share image for overview sharing. This is to share cropped bitmap * with specific share targets (with shortcutInfo and appTarget) rendered in overview. */ @UiThread public static void shareImage(Context context, Supplier<Bitmap> bitmapSupplier, RectF rectF, ShortcutInfo shortcutInfo, AppTarget appTarget, String tag) { if (bitmapSupplier.get() == null) { UI_HELPER_EXECUTOR.execute(() -> { Bitmap bitmap = bitmapSupplier.get(); if (bitmap == null) { return; } Rect crop = new Rect(); rectF.round(crop); Intent intent = new Intent(); Uri uri = getImageUri(bitmapSupplier.get(), crop, context, tag); Uri uri = getImageUri(bitmap, crop, context, tag); ClipData clipdata = new ClipData(new ClipDescription("content", new String[]{"image/png"}), new ClipData.Item(uri)); intent.setAction(Intent.ACTION_SEND) .setComponent(new ComponentName(appTarget.getPackageName(), appTarget.getClassName())) .setComponent( new ComponentName(appTarget.getPackageName(), appTarget.getClassName())) .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) .addFlags(FLAG_GRANT_READ_URI_PERMISSION) .setType("image/png") Loading @@ -115,38 +116,39 @@ public class ImageActionUtils { } else { context.startActivity(intent); } }); } /** * Launch the activity to share image. */ @UiThread public static void startShareActivity(Context context, Supplier<Bitmap> bitmapSupplier, Rect crop, Intent intent, String tag) { if (bitmapSupplier.get() == null) { UI_HELPER_EXECUTOR.execute(() -> { Bitmap bitmap = bitmapSupplier.get(); if (bitmap == null) { Log.e(tag, "No snapshot available, not starting share."); return; } UI_HELPER_EXECUTOR.execute(() -> persistBitmapAndStartActivity(context, bitmapSupplier.get(), crop, intent, ImageActionUtils::getShareIntentForImageUri, tag)); persistBitmapAndStartActivity(context, bitmap, crop, intent, ImageActionUtils::getShareIntentForImageUri, tag); }); } /** * Launch the activity to share image with shared element transition. */ @UiThread public static void startShareActivity(Context context, Supplier<Bitmap> bitmapSupplier, Rect crop, Intent intent, String tag, View sharedElement) { if (bitmapSupplier.get() == null) { UI_HELPER_EXECUTOR.execute(() -> { Bitmap bitmap = bitmapSupplier.get(); if (bitmap == null) { Log.e(tag, "No snapshot available, not starting share."); return; } UI_HELPER_EXECUTOR.execute(() -> persistBitmapAndStartActivity(context, bitmapSupplier.get(), crop, intent, ImageActionUtils::getShareIntentForImageUri, tag, sharedElement)); persistBitmapAndStartActivity(context, bitmap, crop, intent, ImageActionUtils::getShareIntentForImageUri, tag, sharedElement); }); } /** Loading