summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2014-08-18 15:08:33 -0700
committerDianne Hackborn <hackbod@google.com>2014-08-18 15:48:41 -0700
commit15ed2754a308546a54ab1061b4e365d6fe9b898d (patch)
tree454e2961bd63f756b36fe77187b4225fb55982e7
parentf52233df74bb4a3efa1f7b9107353c841eafc933 (diff)
downloadframeworks_base-15ed2754a308546a54ab1061b4e365d6fe9b898d.zip
frameworks_base-15ed2754a308546a54ab1061b4e365d6fe9b898d.tar.gz
frameworks_base-15ed2754a308546a54ab1061b4e365d6fe9b898d.tar.bz2
Fix path for handling system window with app token.
It is wrong to turn the token into a null appWindowToken; we need to create a new top-level token as if they had passed in null. Change-Id: I870d8167c6ed456ea8fd58b149809ec9e0103bce
-rw-r--r--services/core/java/com/android/server/wm/WindowManagerService.java11
-rw-r--r--tests/ActivityTests/AndroidManifest.xml1
-rw-r--r--tests/ActivityTests/src/com/google/android/test/activity/ActivityTestMain.java7
3 files changed, 15 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 112972f..aa20892 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -428,7 +428,7 @@ public class WindowManagerService extends IWindowManager.Stub
/**
* Stores for each user whether screencapture is disabled
* This array is essentially a cache for all userId for
- * {@link android.app.admin.DevicePolicyManager#getScreenCaptureDisabled(null, userId)}
+ * {@link android.app.admin.DevicePolicyManager#getScreenCaptureDisabled}
*/
SparseArray<Boolean> mScreenCaptureDisabled = new SparseArray<Boolean>();
@@ -2315,9 +2315,12 @@ public class WindowManagerService extends IWindowManager.Stub
return WindowManagerGlobal.ADD_BAD_APP_TOKEN;
}
} else if (token.appWindowToken != null) {
- Slog.i(TAG, "Non-null appWindowToken for system window of type=" + type);
- // app token should be null for any other window types.
- token.appWindowToken = null;
+ Slog.w(TAG, "Non-null appWindowToken for system window of type=" + type);
+ // It is not valid to use an app token with other system types; we will
+ // instead make a new token for it (as if null had been passed in for the token).
+ attrs.token = null;
+ token = new WindowToken(this, null, -1, false);
+ addToken = true;
}
win = new WindowState(this, session, client, token,
diff --git a/tests/ActivityTests/AndroidManifest.xml b/tests/ActivityTests/AndroidManifest.xml
index 15d075c..c0898d3 100644
--- a/tests/ActivityTests/AndroidManifest.xml
+++ b/tests/ActivityTests/AndroidManifest.xml
@@ -23,6 +23,7 @@
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" />
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" />
<uses-permission android:name="android.permission.MANAGE_USERS" />
+ <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<application android:label="ActivityTest">
<activity android:name="ActivityTestMain">
<intent-filter>
diff --git a/tests/ActivityTests/src/com/google/android/test/activity/ActivityTestMain.java b/tests/ActivityTests/src/com/google/android/test/activity/ActivityTestMain.java
index 0e063d6..9002125 100644
--- a/tests/ActivityTests/src/com/google/android/test/activity/ActivityTestMain.java
+++ b/tests/ActivityTests/src/com/google/android/test/activity/ActivityTestMain.java
@@ -34,6 +34,7 @@ import android.os.RemoteException;
import android.os.UserHandle;
import android.os.UserManager;
import android.graphics.Bitmap;
+import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
@@ -130,6 +131,12 @@ public class ActivityTestMain extends Activity {
mSecondUser = ui.id;
}
}
+
+ /*
+ AlertDialog ad = new AlertDialog.Builder(this).setTitle("title").setMessage("message").create();
+ ad.getWindow().getAttributes().type = WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;
+ ad.show();
+ */
}
@Override