summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjuwei <juwei@codeaurora.org>2016-12-26 14:13:34 +0800
committerjuwei <juwei@codeaurora.org>2017-01-03 10:19:02 +0800
commit1cd619462687108bac30d876a4ab8c2a195231cd (patch)
tree70fa115ee922d6ab2ffffd83aeb938a0fddbb02a /src
parent2f89961fd763d226b2f4a595bfb77e1a491c01e5 (diff)
downloadandroid_packages_apps_Snap-1cd619462687108bac30d876a4ab8c2a195231cd.tar.gz
android_packages_apps_Snap-1cd619462687108bac30d876a4ab8c2a195231cd.tar.bz2
android_packages_apps_Snap-1cd619462687108bac30d876a4ab8c2a195231cd.zip
SnapdragonCamera: Fix ANR caused by layout logic
child view calls setLayoutParams() in parent view onLayout(), this may lead to a recursion: Child layout params changed -> parent onRequestLayout -> parent view onLayout -> child layout params changed. At last, main thread is busy in processing this unnecessary recursion and block. So move the setLayoutParams() int parent view onSizeChanged(). Change-Id: Ie230abe25caa9bd38f134f41257188cd335f7975 CRs-Fixed: 1105184
Diffstat (limited to 'src')
-rw-r--r--[-rwxr-xr-x]src/com/android/camera/ui/OneUICameraControls.java30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/com/android/camera/ui/OneUICameraControls.java b/src/com/android/camera/ui/OneUICameraControls.java
index 3dce60d22..2c94cac16 100755..100644
--- a/src/com/android/camera/ui/OneUICameraControls.java
+++ b/src/com/android/camera/ui/OneUICameraControls.java
@@ -238,26 +238,32 @@ public class OneUICameraControls extends RotatableLayout {
}
@Override
+ public void onSizeChanged(int w, int h, int oldw, int oldh){
+ super.onSizeChanged(w, h, oldw, oldh);
+
+ mWidth = w;
+ mHeight = h;
+ if(mMakeupSeekBar != null) {
+ mMakeupSeekBar.setMinimumWidth(mWidth/2);
+ }
+ ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(mWidth/ 4,mWidth/4);
+ mExposureLayout.setLayoutParams(lp);
+ mManualLayout.setLayoutParams(lp);
+ mWhiteBalanceLayout.setLayoutParams(lp);
+ mIsoLayout.setLayoutParams(lp);
+
+ }
+
+ @Override
public void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
r = r - l;
b = b - t;
l = 0;
t = 0;
- mWidth = r;
- mHeight = b;
+
setLocation(r - l, b - t);
layoutRemaingPhotos();
- if(mMakeupSeekBar != null) {
- mMakeupSeekBar.setMinimumWidth(mWidth/2);
- }
-
- LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(mWidth/ 4,mWidth/4);
- mExposureLayout.setLayoutParams(lp);
-
- mManualLayout.setLayoutParams(lp);
- mWhiteBalanceLayout.setLayoutParams(lp);
- mIsoLayout.setLayoutParams(lp);
initializeProMode(mProModeOn);
}