summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/app/Presentation.java10
-rw-r--r--core/java/android/bluetooth/BluetoothSocket.java14
-rw-r--r--core/java/android/bluetooth/IBluetoothHeadsetPhone.aidl14
-rw-r--r--core/java/android/bluetooth/IBluetoothHealth.aidl14
-rwxr-xr-xcore/java/android/bluetooth/IBluetoothInputDevice.aidl15
-rwxr-xr-xcore/java/android/bluetooth/IBluetoothManager.aidl14
-rw-r--r--core/java/android/bluetooth/IBluetoothManagerCallback.aidl14
-rw-r--r--core/java/android/bluetooth/IBluetoothPan.aidl15
-rw-r--r--core/java/android/view/Display.java56
-rw-r--r--core/java/android/view/DisplayInfo.java3
-rw-r--r--core/java/android/view/SurfaceView.java22
-rw-r--r--core/java/android/view/ViewManager.java10
-rw-r--r--core/java/android/view/ViewRootImpl.java42
-rw-r--r--core/java/android/view/WindowManager.java22
-rw-r--r--core/java/android/view/WindowManagerGlobal.java37
15 files changed, 252 insertions, 50 deletions
diff --git a/core/java/android/app/Presentation.java b/core/java/android/app/Presentation.java
index b5e5244..20b27c5 100644
--- a/core/java/android/app/Presentation.java
+++ b/core/java/android/app/Presentation.java
@@ -141,6 +141,16 @@ public class Presentation extends Dialog {
}
/**
+ * Inherited from {@link Dialog#show}. Will throw
+ * {@link android.view.WindowManager.InvalidDisplayException} if the specified secondary
+ * {@link Display} can't be found.
+ */
+ @Override
+ public void show() {
+ super.show();
+ }
+
+ /**
* Called by the system when the {@link Display} to which the presentation
* is attached has been removed.
*
diff --git a/core/java/android/bluetooth/BluetoothSocket.java b/core/java/android/bluetooth/BluetoothSocket.java
index 8cbf5b1..26bde19 100644
--- a/core/java/android/bluetooth/BluetoothSocket.java
+++ b/core/java/android/bluetooth/BluetoothSocket.java
@@ -1,5 +1,17 @@
/*
- * Copyright (C) 2012 Google Inc.
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package android.bluetooth;
diff --git a/core/java/android/bluetooth/IBluetoothHeadsetPhone.aidl b/core/java/android/bluetooth/IBluetoothHeadsetPhone.aidl
index 163e4e2..d5e64f6 100644
--- a/core/java/android/bluetooth/IBluetoothHeadsetPhone.aidl
+++ b/core/java/android/bluetooth/IBluetoothHeadsetPhone.aidl
@@ -1,5 +1,17 @@
/*
- * Copyright (C) 2012 Google Inc.
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package android.bluetooth;
diff --git a/core/java/android/bluetooth/IBluetoothHealth.aidl b/core/java/android/bluetooth/IBluetoothHealth.aidl
index e741da4..a84a42c 100644
--- a/core/java/android/bluetooth/IBluetoothHealth.aidl
+++ b/core/java/android/bluetooth/IBluetoothHealth.aidl
@@ -1,5 +1,17 @@
/*
- * Copyright (C) 2012 Google Inc.
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package android.bluetooth;
diff --git a/core/java/android/bluetooth/IBluetoothInputDevice.aidl b/core/java/android/bluetooth/IBluetoothInputDevice.aidl
index 23e6d50..1ebb9ca 100755
--- a/core/java/android/bluetooth/IBluetoothInputDevice.aidl
+++ b/core/java/android/bluetooth/IBluetoothInputDevice.aidl
@@ -1,6 +1,19 @@
/*
- * Copyright (C) 2012 Google Inc.
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
+
package android.bluetooth;
import android.bluetooth.BluetoothDevice;
diff --git a/core/java/android/bluetooth/IBluetoothManager.aidl b/core/java/android/bluetooth/IBluetoothManager.aidl
index de8fe91..ed8777c 100755
--- a/core/java/android/bluetooth/IBluetoothManager.aidl
+++ b/core/java/android/bluetooth/IBluetoothManager.aidl
@@ -1,5 +1,17 @@
/*
- * Copyright (C) 2012 Google Inc.
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package android.bluetooth;
diff --git a/core/java/android/bluetooth/IBluetoothManagerCallback.aidl b/core/java/android/bluetooth/IBluetoothManagerCallback.aidl
index 3e795ea..9551086 100644
--- a/core/java/android/bluetooth/IBluetoothManagerCallback.aidl
+++ b/core/java/android/bluetooth/IBluetoothManagerCallback.aidl
@@ -1,5 +1,17 @@
/*
- * Copyright (C) 2012 Google Inc.
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package android.bluetooth;
diff --git a/core/java/android/bluetooth/IBluetoothPan.aidl b/core/java/android/bluetooth/IBluetoothPan.aidl
index b91bd7d..5a32347 100644
--- a/core/java/android/bluetooth/IBluetoothPan.aidl
+++ b/core/java/android/bluetooth/IBluetoothPan.aidl
@@ -1,6 +1,19 @@
/*
- * Copyright (C) 2012 Google Inc.
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
+
package android.bluetooth;
import android.bluetooth.BluetoothDevice;
diff --git a/core/java/android/view/Display.java b/core/java/android/view/Display.java
index 662dc45..1cd3e05 100644
--- a/core/java/android/view/Display.java
+++ b/core/java/android/view/Display.java
@@ -82,22 +82,65 @@ public final class Display {
* Display flag: Indicates that the display supports compositing content
* that is stored in protected graphics buffers.
* <p>
+ * If this flag is set then the display device supports compositing protected buffers.
+ * </p><p>
+ * If this flag is not set then the display device may not support compositing
+ * protected buffers; the user may see a blank region on the screen instead of
+ * the protected content.
+ * </p><p>
* Secure (DRM) video decoders may allocate protected graphics buffers to request that
* a hardware-protected path be provided between the video decoder and the external
* display sink. If a hardware-protected path is not available, then content stored
* in protected graphics buffers may not be composited.
* </p><p>
- * If this flag is not set, then the display device does not support compositing
- * protected buffers; the user may see a blank region on the screen instead of
- * the protected content. An application can use this flag as a hint that it should
- * select an alternate content stream or adopt a different strategy for decoding
- * content that does not rely on protected buffers so as to ensure that the user
- * can view the content on the display as expected.
+ * An application can use the absence of this flag as a hint that it should not use protected
+ * buffers for this display because the content may not be visible. For example,
+ * if the flag is not set then the application may choose not to show content on this
+ * display, show an informative error message, select an alternate content stream
+ * or adopt a different strategy for decoding content that does not rely on
+ * protected buffers.
* </p>
+ *
+ * @see #getFlags
*/
public static final int FLAG_SUPPORTS_PROTECTED_BUFFERS = 1 << 0;
/**
+ * Display flag: Indicates that the display has a secure video output and
+ * supports compositing secure surfaces.
+ * <p>
+ * If this flag is set then the display device has a secure video output
+ * and is capable of showing secure surfaces. It may also be capable of
+ * showing {@link #FLAG_SUPPORTS_PROTECTED_BUFFERS protected buffers}.
+ * </p><p>
+ * If this flag is not set then the display device may not have a secure video
+ * output; the user may see a blank region on the screen instead of
+ * the contents of secure surfaces or protected buffers.
+ * </p><p>
+ * Secure surfaces are used to prevent content rendered into those surfaces
+ * by applications from appearing in screenshots or from being viewed
+ * on non-secure displays. Protected buffers are used by secure video decoders
+ * for a similar purpose.
+ * </p><p>
+ * An application creates a window with a secure surface by specifying the
+ * {@link WindowManager.LayoutParams#FLAG_SECURE} window flag.
+ * Likewise, an application creates a {@link SurfaceView} with a secure surface
+ * by calling {@link SurfaceView#setSecure} before attaching the secure view to
+ * its containing window.
+ * </p><p>
+ * An application can use the absence of this flag as a hint that it should not create
+ * secure surfaces or protected buffers on this display because the content may
+ * not be visible. For example, if the flag is not set then the application may
+ * choose not to show content on this display, show an informative error message,
+ * select an alternate content stream or adopt a different strategy for decoding
+ * content that does not rely on secure surfaces or protected buffers.
+ * </p>
+ *
+ * @see #getFlags
+ */
+ public static final int FLAG_SECURE = 1 << 1;
+
+ /**
* Internal method to create a display.
* Applications should use {@link android.view.WindowManager#getDefaultDisplay()}
* or {@link android.hardware.display.DisplayManager#getDisplay}
@@ -182,6 +225,7 @@ public final class Display {
* @return The display flags.
*
* @see #FLAG_SUPPORTS_PROTECTED_BUFFERS
+ * @see #FLAG_SECURE
*/
public int getFlags() {
synchronized (this) {
diff --git a/core/java/android/view/DisplayInfo.java b/core/java/android/view/DisplayInfo.java
index fb04150..ead5ff4 100644
--- a/core/java/android/view/DisplayInfo.java
+++ b/core/java/android/view/DisplayInfo.java
@@ -299,6 +299,9 @@ public final class DisplayInfo implements Parcelable {
private static String flagsToString(int flags) {
StringBuilder result = new StringBuilder();
+ if ((flags & Display.FLAG_SECURE) != 0) {
+ result.append(", FLAG_SECURE");
+ }
if ((flags & Display.FLAG_SUPPORTS_PROTECTED_BUFFERS) != 0) {
result.append(", FLAG_SUPPORTS_PROTECTED_BUFFERS");
}
diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java
index 0d16dd3..9008521 100644
--- a/core/java/android/view/SurfaceView.java
+++ b/core/java/android/view/SurfaceView.java
@@ -385,7 +385,27 @@ public class SurfaceView extends View {
mLayout.flags &= ~WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
}
}
-
+
+ /**
+ * Control whether the surface view's content should be treated as secure,
+ * preventing it from appearing in screenshots or from being viewed on
+ * non-secure displays.
+ *
+ * <p>Note that this must be set before the surface view's containing
+ * window is attached to the window manager.
+ *
+ * <p>See {@link android.view.Display#FLAG_SECURE} for details.
+ *
+ * @param isSecure True if the surface view is secure.
+ */
+ public void setSecure(boolean isSecure) {
+ if (isSecure) {
+ mLayout.flags |= WindowManager.LayoutParams.FLAG_SECURE;
+ } else {
+ mLayout.flags &= ~WindowManager.LayoutParams.FLAG_SECURE;
+ }
+ }
+
/**
* Hack to allow special layering of windows. The type is one of the
* types in WindowManager.LayoutParams. This is a hack so:
diff --git a/core/java/android/view/ViewManager.java b/core/java/android/view/ViewManager.java
index 7f318c1..ab6856f 100644
--- a/core/java/android/view/ViewManager.java
+++ b/core/java/android/view/ViewManager.java
@@ -21,6 +21,16 @@ package android.view;
*/
public interface ViewManager
{
+ /**
+ * Assign the passed LayoutParams to the passed View and add the view to the window.
+ * <p>Throws {@link android.view.WindowManager.BadTokenException} for certain programming
+ * errors, such as adding a second view to a window without removing the first view.
+ * <p>Throws {@link android.view.WindowManager.InvalidDisplayException} if the window is on a
+ * secondary {@link Display} and the specified display can't be found
+ * (see {@link android.app.Presentation}).
+ * @param view The view to be added to this window.
+ * @param params The LayoutParams to assign to view.
+ */
public void addView(View view, ViewGroup.LayoutParams params);
public void updateViewLayout(View view, ViewGroup.LayoutParams params);
public void removeView(View view);
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index ded4cfc..a3360bc 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -29,14 +29,12 @@ import android.content.res.CompatibilityInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Canvas;
-import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.PixelFormat;
import android.graphics.Point;
import android.graphics.PointF;
import android.graphics.PorterDuff;
import android.graphics.Rect;
-import android.graphics.RectF;
import android.graphics.Region;
import android.graphics.drawable.Drawable;
import android.media.AudioManager;
@@ -558,7 +556,6 @@ public final class ViewRootImpl implements ViewParent,
mPendingVisibleInsets.set(0, 0, 0, 0);
if (DEBUG_LAYOUT) Log.v(TAG, "Added window " + mWindow);
if (res < WindowManagerGlobal.ADD_OKAY) {
- mView = null;
mAttachInfo.mRootView = null;
mAdded = false;
mFallbackEventHandler.setView(null);
@@ -594,6 +591,10 @@ public final class ViewRootImpl implements ViewParent,
throw new WindowManager.BadTokenException(
"Unable to add window " + mWindow +
" -- permission denied for this window type");
+ case WindowManagerGlobal.ADD_INVALID_DISPLAY:
+ throw new WindowManager.InvalidDisplayException(
+ "Unable to add window " + mWindow +
+ " -- the specified display can not be found");
}
throw new RuntimeException(
"Unable to add window -- unknown error code " + res);
@@ -810,27 +811,21 @@ public final class ViewRootImpl implements ViewParent,
}
}
- /**
- * {@inheritDoc}
- */
+ @Override
public void requestFitSystemWindows() {
checkThread();
mFitSystemWindowsRequested = true;
scheduleTraversals();
}
- /**
- * {@inheritDoc}
- */
+ @Override
public void requestLayout() {
checkThread();
mLayoutRequested = true;
scheduleTraversals();
}
- /**
- * {@inheritDoc}
- */
+ @Override
public boolean isLayoutRequested() {
return mLayoutRequested;
}
@@ -850,6 +845,7 @@ public final class ViewRootImpl implements ViewParent,
}
}
+ @Override
public void invalidateChild(View child, Rect dirty) {
invalidateChildInParent(null, dirty);
}
@@ -861,7 +857,7 @@ public final class ViewRootImpl implements ViewParent,
if (dirty == null) {
invalidate();
return null;
- } else if (dirty.isEmpty()) {
+ } else if (dirty.isEmpty() && !mIsAnimating) {
return null;
}
@@ -890,14 +886,14 @@ public final class ViewRootImpl implements ViewParent,
// Intersect with the bounds of the window to skip
// updates that lie outside of the visible region
final float appScale = mAttachInfo.mApplicationScale;
- if (localDirty.intersect(0, 0,
- (int) (mWidth * appScale + 0.5f), (int) (mHeight * appScale + 0.5f))) {
- if (!mWillDrawSoon) {
- scheduleTraversals();
- }
- } else {
+ final boolean intersected = localDirty.intersect(0, 0,
+ (int) (mWidth * appScale + 0.5f), (int) (mHeight * appScale + 0.5f));
+ if (!intersected) {
localDirty.setEmpty();
}
+ if (!mWillDrawSoon && (intersected || mIsAnimating)) {
+ scheduleTraversals();
+ }
return null;
}
@@ -1440,7 +1436,13 @@ public final class ViewRootImpl implements ViewParent,
mTranslator.translateCanvas(layerCanvas);
}
- mView.draw(layerCanvas);
+ DisplayList displayList = mView.mDisplayList;
+ if (displayList != null) {
+ layerCanvas.drawDisplayList(displayList, null,
+ DisplayList.FLAG_CLIP_CHILDREN);
+ } else {
+ mView.draw(layerCanvas);
+ }
drawAccessibilityFocusedDrawableIfNeeded(layerCanvas);
diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java
index 4c97414..3b31ff6 100644
--- a/core/java/android/view/WindowManager.java
+++ b/core/java/android/view/WindowManager.java
@@ -62,6 +62,19 @@ public interface WindowManager extends ViewManager {
}
/**
+ * Exception that is thrown when calling {@link #addView} to a secondary display that cannot
+ * be found. See {@link android.app.Presentation} for more information on secondary displays.
+ */
+ public static class InvalidDisplayException extends RuntimeException {
+ public InvalidDisplayException() {
+ }
+
+ public InvalidDisplayException(String name) {
+ super(name);
+ }
+ }
+
+ /**
* Returns the {@link Display} upon which this {@link WindowManager} instance
* will create new windows.
* <p>
@@ -615,8 +628,13 @@ public interface WindowManager extends ViewManager {
@Deprecated
public static final int FLAG_DITHER = 0x00001000;
- /** Window flag: don't allow screen shots while this window is
- * displayed. Maps to Surface.SECURE. */
+ /** Window flag: Treat the content of the window as secure, preventing
+ * it from appearing in screenshots or from being viewed on non-secure
+ * displays.
+ *
+ * <p>See {@link android.view.Display#FLAG_SECURE} for more details about
+ * secure surfaces and secure displays.
+ */
public static final int FLAG_SECURE = 0x00002000;
/** Window flag: a special mode where the layout parameters are used
diff --git a/core/java/android/view/WindowManagerGlobal.java b/core/java/android/view/WindowManagerGlobal.java
index 5cdc1ed..e8945aa 100644
--- a/core/java/android/view/WindowManagerGlobal.java
+++ b/core/java/android/view/WindowManagerGlobal.java
@@ -186,8 +186,8 @@ public final class WindowManagerGlobal {
mSystemPropertyUpdater = new Runnable() {
@Override public void run() {
synchronized (mLock) {
- for (ViewRootImpl root : mRoots) {
- root.loadSystemProperties();
+ for (ViewRootImpl viewRoot : mRoots) {
+ viewRoot.loadSystemProperties();
}
}
}
@@ -242,7 +242,18 @@ public final class WindowManagerGlobal {
}
// do this last because it fires off messages to start doing things
- root.setView(view, wparams, panelParentView);
+ try {
+ root.setView(view, wparams, panelParentView);
+ } catch (RuntimeException e) {
+ // BadTokenException or InvalidDisplayException, clean up.
+ synchronized (mLock) {
+ final int index = findViewLocked(view, false);
+ if (index >= 0) {
+ removeViewLocked(index, true);
+ }
+ }
+ throw e;
+ }
}
public void updateViewLayout(View view, ViewGroup.LayoutParams params) {
@@ -360,20 +371,18 @@ public final class WindowManagerGlobal {
}
private int findViewLocked(View view, boolean required) {
- synchronized (mLock) {
- if (mViews != null) {
- final int count = mViews.length;
- for (int i = 0; i < count; i++) {
- if (mViews[i] == view) {
- return i;
- }
+ if (mViews != null) {
+ final int count = mViews.length;
+ for (int i = 0; i < count; i++) {
+ if (mViews[i] == view) {
+ return i;
}
}
- if (required) {
- throw new IllegalArgumentException("View not attached to window manager");
- }
- return -1;
}
+ if (required) {
+ throw new IllegalArgumentException("View not attached to window manager");
+ }
+ return -1;
}
public void startTrimMemory(int level) {