无法将Gallery小部件添加到主屏幕

文章描述了在Android相机应用中,Gallerywidget无法成功添加到主屏幕的问题,通过复现步骤发现与CropActivity中的最大图片尺寸限制有关。解决方案是调整返回意图中的最大位图大小,以确保适配不同设备。
摘要由CSDN通过智能技术生成

Issue:
"

Actual Results: [NGMS]Fail to add Gallery widgets to home screen

Expected Results: [NGMS]Gallery widgets should be added to home screen successfully

Reproduction Steps:

  1. Open camera app and capture some image
  2. Long Tap Gallery app
  3. Tap widget icon on the top
  4. Touch & hold to pick up Photo Gallery widget 3x3
  5. Drag it to home screen

Find, Fail to add Gallery widgets to home screen==>Problem
"
Solution:
"
Solution: Adjust the maximum bitmap size which allow to be returned through the intent.
"
 

packages/apps/Gallery2/src/com/android/gallery3d/filtershow/crop/CropActivity.java

 

diff --git a/src/com/android/gallery3d/filtershow/crop/CropActivity.java b/src/com/android/gallery3d/filtershow/crop/CropActivity.java
index 3a78296..6c4939c 100644
--- a/src/com/android/gallery3d/filtershow/crop/CropActivity.java
+++ b/src/com/android/gallery3d/filtershow/crop/CropActivity.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2013 The Android Open Source Project
+ * Copyright (c) 2023 Zebra Technologies Corporation and/or its affiliates. All rights reserved
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -54,6 +55,8 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 
+import com.xxx.util.XXXUtils;
+
 /**
  * Activity for cropping an image.
  */
@@ -440,7 +443,11 @@
                 assert (img != null);
                 Bitmap ret = getCroppedImage(img, mCrop, mPhoto);
                 if (ret != null) {
-                    ret = getDownsampledBitmap(ret, MAX_BMAP_IN_INTENT);
+                    if (XXXUtils.isXXX().orElse(false)) {
+                        ret = getDownsampledBitmap(ret, 490000);
+                    } else {
+                        ret = getDownsampledBitmap(ret, MAX_BMAP_IN_INTENT);
+                    }
                 }
                 if (ret == null) {
                     Log.w(LOGTAG, "could not downsample bitmap to return in data");

  • 9
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值