diff options
author | Dianne Hackborn <hackbod@google.com> | 2015-07-31 13:10:55 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2015-07-31 13:10:55 -0700 |
commit | afb308d6519c56cf2b8001b33dade35e682ab241 (patch) | |
tree | 8c898714a4056f385ba8bf6642fa52481e0d01d9 | |
parent | 692a244bffea11157c37c8de93482cb912599b98 (diff) | |
download | frameworks_base-afb308d6519c56cf2b8001b33dade35e682ab241.zip frameworks_base-afb308d6519c56cf2b8001b33dade35e682ab241.tar.gz frameworks_base-afb308d6519c56cf2b8001b33dade35e682ab241.tar.bz2 |
Fix issue #21895842: Add is_assist_blocked to assist.ViewNode.NodeProperties
Change-Id: I928882d42d0546cc6a12e803d96131beaba76d4e
6 files changed, 38 insertions, 6 deletions
diff --git a/core/java/android/app/assist/AssistStructure.java b/core/java/android/app/assist/AssistStructure.java index e08686c..6b720c0 100644 --- a/core/java/android/app/assist/AssistStructure.java +++ b/core/java/android/app/assist/AssistStructure.java @@ -1106,7 +1106,7 @@ public class AssistStructure implements Parcelable { @Override public void setAssistBlocked(boolean state) { mNode.mFlags = (mNode.mFlags&~ViewNode.FLAGS_ASSIST_BLOCKED) - | (state ? 0 : ViewNode.FLAGS_ASSIST_BLOCKED); + | (state ? ViewNode.FLAGS_ASSIST_BLOCKED : 0); } @Override @@ -1412,6 +1412,9 @@ public class AssistStructure implements Parcelable { if (extras != null) { Log.i(TAG, prefix + " Extras: " + extras); } + if (node.isAssistBlocked()) { + Log.i(TAG, prefix + " BLOCKED"); + } final int NCHILDREN = node.getChildCount(); if (NCHILDREN > 0) { Log.i(TAG, prefix + " Children:"); diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index d9828cc..26e75bd 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -2658,6 +2658,16 @@ public class WindowManagerService extends IWindowManager.Stub return disabled; } + boolean isSecureLocked(WindowState w) { + if ((w.mAttrs.flags&WindowManager.LayoutParams.FLAG_SECURE) != 0) { + return true; + } + if (isScreenCaptureDisabledLocked(UserHandle.getUserId(w.mOwnerUid))) { + return true; + } + return false; + } + /** * Set mScreenCaptureDisabled for specific user */ @@ -3169,6 +3179,9 @@ public class WindowManagerService extends IWindowManager.Stub boolean wallpaperMayMove = win.mViewVisibility != viewVisibility && (win.mAttrs.flags & FLAG_SHOW_WALLPAPER) != 0; wallpaperMayMove |= (flagChanges & FLAG_SHOW_WALLPAPER) != 0; + if ((flagChanges & FLAG_SECURE) != 0 && winAnimator.mSurfaceControl != null) { + winAnimator.mSurfaceControl.setSecure(isSecureLocked(win)); + } win.mRelayoutCalled = true; final int oldVisibility = win.mViewVisibility; diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java index 3251a56..ed67b7d 100644 --- a/services/core/java/com/android/server/wm/WindowStateAnimator.java +++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java @@ -788,11 +788,7 @@ class WindowStateAnimator { int flags = SurfaceControl.HIDDEN; final WindowManager.LayoutParams attrs = w.mAttrs; - if ((attrs.flags&WindowManager.LayoutParams.FLAG_SECURE) != 0) { - flags |= SurfaceControl.SECURE; - } - - if (mService.isScreenCaptureDisabledLocked(UserHandle.getUserId(mWin.mOwnerUid))) { + if (mService.isSecureLocked(w)) { flags |= SurfaceControl.SECURE; } diff --git a/tests/VoiceInteraction/res/layout/main.xml b/tests/VoiceInteraction/res/layout/main.xml index 0f968eb..a83d02c 100644 --- a/tests/VoiceInteraction/res/layout/main.xml +++ b/tests/VoiceInteraction/res/layout/main.xml @@ -26,6 +26,12 @@ android:text="@string/start" /> + <CheckBox android:id="@+id/secure" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/secure" + /> + <com.android.test.voiceinteraction.AsyncStructure android:layout_width="match_parent" android:layout_height="wrap_content" diff --git a/tests/VoiceInteraction/res/values/strings.xml b/tests/VoiceInteraction/res/values/strings.xml index ab39f99..29ffe21 100644 --- a/tests/VoiceInteraction/res/values/strings.xml +++ b/tests/VoiceInteraction/res/values/strings.xml @@ -17,6 +17,7 @@ <resources> <string name="start">Start</string> + <string name="secure">Secure</string> <string name="tree">Tree</string> <string name="text">Text</string> <string name="asyncStructure">(Async structure goes here)</string> diff --git a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/VoiceInteractionMain.java b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/VoiceInteractionMain.java index ee75f28..87fa91a 100644 --- a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/VoiceInteractionMain.java +++ b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/VoiceInteractionMain.java @@ -21,6 +21,8 @@ import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.view.View; +import android.view.WindowManager; +import android.widget.CheckBox; public class VoiceInteractionMain extends Activity { @@ -30,6 +32,7 @@ public class VoiceInteractionMain extends Activity { setContentView(R.layout.main); findViewById(R.id.start).setOnClickListener(mStartListener); + findViewById(R.id.secure).setOnClickListener(mSecureListener); } @Override @@ -52,4 +55,14 @@ public class VoiceInteractionMain extends Activity { showAssist(null); } }; + + View.OnClickListener mSecureListener = new View.OnClickListener() { + public void onClick(View v) { + if (((CheckBox)v).isChecked()) { + getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE); + } else { + getWindow().clearFlags(WindowManager.LayoutParams.FLAG_SECURE); + } + } + }; } |