diff options
author | Dianne Hackborn <hackbod@google.com> | 2015-08-01 16:53:27 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-08-01 16:53:27 +0000 |
commit | 44ffe9cb33b0ec51d411b7413d222ab251777529 (patch) | |
tree | 8f8dbfb5b2a5c3ea1f290b2f523719596568e9e8 | |
parent | aff9c63815865e937cf2d1d242f2073dc8413d5e (diff) | |
parent | cba2c59612fc608c6f0e9c3823cac1435a2d29d8 (diff) | |
download | frameworks_base-44ffe9cb33b0ec51d411b7413d222ab251777529.zip frameworks_base-44ffe9cb33b0ec51d411b7413d222ab251777529.tar.gz frameworks_base-44ffe9cb33b0ec51d411b7413d222ab251777529.tar.bz2 |
am cba2c596: am 6aa0843e: am fb68b0ad: Merge "Fix issue #21895842: Add is_assist_blocked to assist.ViewNode.NodeProperties" into mnc-dev
* commit 'cba2c59612fc608c6f0e9c3823cac1435a2d29d8':
Fix issue #21895842: Add is_assist_blocked to assist.ViewNode.NodeProperties
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 f6ea777..7018bac 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 5ae7c94..3ac6bba 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); + } + } + }; } |