Merge "Remove class that was moved to a different package." into lmp-dev
diff --git a/api/current.txt b/api/current.txt
index f90596e..e21bfb9 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -21602,6 +21602,8 @@
method public short getShort(java.lang.String);
method public short getShort(java.lang.String, short);
method public short[] getShortArray(java.lang.String);
+ method public android.util.Size getSize(java.lang.String);
+ method public android.util.SizeF getSizeF(java.lang.String);
method public android.util.SparseArray<T> getSparseParcelableArray(java.lang.String);
method public java.util.ArrayList<java.lang.String> getStringArrayList(java.lang.String);
method public boolean hasFileDescriptors();
@@ -21626,6 +21628,8 @@
method public void putSerializable(java.lang.String, java.io.Serializable);
method public void putShort(java.lang.String, short);
method public void putShortArray(java.lang.String, short[]);
+ method public void putSize(java.lang.String, android.util.Size);
+ method public void putSizeF(java.lang.String, android.util.SizeF);
method public void putSparseParcelableArray(java.lang.String, android.util.SparseArray<? extends android.os.Parcelable>);
method public void putStringArrayList(java.lang.String, java.util.ArrayList<java.lang.String>);
method public void readFromParcel(android.os.Parcel);
@@ -22077,6 +22081,8 @@
method public final android.os.PersistableBundle readPersistableBundle();
method public final android.os.PersistableBundle readPersistableBundle(java.lang.ClassLoader);
method public final java.io.Serializable readSerializable();
+ method public final android.util.Size readSize();
+ method public final android.util.SizeF readSizeF();
method public final android.util.SparseArray readSparseArray(java.lang.ClassLoader);
method public final android.util.SparseBooleanArray readSparseBooleanArray();
method public final java.lang.String readString();
@@ -22118,6 +22124,8 @@
method public final void writeParcelableArray(T[], int);
method public final void writePersistableBundle(android.os.PersistableBundle);
method public final void writeSerializable(java.io.Serializable);
+ method public final void writeSize(android.util.Size);
+ method public final void writeSizeF(android.util.SizeF);
method public final void writeSparseArray(android.util.SparseArray<java.lang.Object>);
method public final void writeSparseBooleanArray(android.util.SparseBooleanArray);
method public final void writeString(java.lang.String);
@@ -32136,23 +32144,17 @@
field public static final android.util.Rational ZERO;
}
- public final class Size implements android.os.Parcelable {
+ public final class Size {
ctor public Size(int, int);
- method public int describeContents();
method public int getHeight();
method public int getWidth();
method public static android.util.Size parseSize(java.lang.String) throws java.lang.NumberFormatException;
- method public void writeToParcel(android.os.Parcel, int);
- field public static final android.os.Parcelable.Creator CREATOR;
}
- public final class SizeF implements android.os.Parcelable {
+ public final class SizeF {
ctor public SizeF(float, float);
- method public int describeContents();
method public float getHeight();
method public float getWidth();
- method public void writeToParcel(android.os.Parcel, int);
- field public static final android.os.Parcelable.Creator CREATOR;
}
public class SparseArray implements java.lang.Cloneable {
diff --git a/core/java/android/os/Bundle.java b/core/java/android/os/Bundle.java
index 3252d19..a9aa570 100644
--- a/core/java/android/os/Bundle.java
+++ b/core/java/android/os/Bundle.java
@@ -17,6 +17,8 @@
package android.os;
import android.util.ArrayMap;
+import android.util.Size;
+import android.util.SizeF;
import android.util.SparseArray;
import java.io.Serializable;
@@ -335,6 +337,30 @@
}
/**
+ * Inserts a Size value into the mapping of this Bundle, replacing
+ * any existing value for the given key. Either key or value may be null.
+ *
+ * @param key a String, or null
+ * @param value a Size object, or null
+ */
+ public void putSize(String key, Size value) {
+ unparcel();
+ mMap.put(key, value);
+ }
+
+ /**
+ * Inserts a SizeF value into the mapping of this Bundle, replacing
+ * any existing value for the given key. Either key or value may be null.
+ *
+ * @param key a String, or null
+ * @param value a SizeF object, or null
+ */
+ public void putSizeF(String key, SizeF value) {
+ unparcel();
+ mMap.put(key, value);
+ }
+
+ /**
* Inserts an array of Parcelable values into the mapping of this Bundle,
* replacing any existing value for the given key. Either key or value may
* be null.
@@ -712,6 +738,44 @@
* value is explicitly associated with the key.
*
* @param key a String, or null
+ * @return a Size value, or null
+ */
+ public Size getSize(String key) {
+ unparcel();
+ final Object o = mMap.get(key);
+ try {
+ return (Size) o;
+ } catch (ClassCastException e) {
+ typeWarning(key, o, "Size", e);
+ return null;
+ }
+ }
+
+ /**
+ * Returns the value associated with the given key, or null if
+ * no mapping of the desired type exists for the given key or a null
+ * value is explicitly associated with the key.
+ *
+ * @param key a String, or null
+ * @return a Size value, or null
+ */
+ public SizeF getSizeF(String key) {
+ unparcel();
+ final Object o = mMap.get(key);
+ try {
+ return (SizeF) o;
+ } catch (ClassCastException e) {
+ typeWarning(key, o, "SizeF", e);
+ return null;
+ }
+ }
+
+ /**
+ * Returns the value associated with the given key, or null if
+ * no mapping of the desired type exists for the given key or a null
+ * value is explicitly associated with the key.
+ *
+ * @param key a String, or null
* @return a Bundle value, or null
*/
public Bundle getBundle(String key) {
diff --git a/core/java/android/os/Parcel.java b/core/java/android/os/Parcel.java
index 645d510..d1ad0ad 100644
--- a/core/java/android/os/Parcel.java
+++ b/core/java/android/os/Parcel.java
@@ -19,6 +19,8 @@
import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.Log;
+import android.util.Size;
+import android.util.SizeF;
import android.util.SparseArray;
import android.util.SparseBooleanArray;
@@ -224,6 +226,8 @@
private static final int VAL_BOOLEANARRAY = 23;
private static final int VAL_CHARSEQUENCEARRAY = 24;
private static final int VAL_PERSISTABLEBUNDLE = 25;
+ private static final int VAL_SIZE = 26;
+ private static final int VAL_SIZEF = 27;
// The initial int32 in a Binder call's reply Parcel header:
private static final int EX_SECURITY = -1;
@@ -672,6 +676,24 @@
}
/**
+ * Flatten a Size into the parcel at the current dataPosition(),
+ * growing dataCapacity() if needed.
+ */
+ public final void writeSize(Size val) {
+ writeInt(val.getWidth());
+ writeInt(val.getHeight());
+ }
+
+ /**
+ * Flatten a SizeF into the parcel at the current dataPosition(),
+ * growing dataCapacity() if needed.
+ */
+ public final void writeSizeF(SizeF val) {
+ writeFloat(val.getWidth());
+ writeFloat(val.getHeight());
+ }
+
+ /**
* Flatten a List into the parcel at the current dataPosition(), growing
* dataCapacity() if needed. The List values are written using
* {@link #writeValue} and must follow the specification there.
@@ -1293,6 +1315,12 @@
} else if (v instanceof PersistableBundle) {
writeInt(VAL_PERSISTABLEBUNDLE);
writePersistableBundle((PersistableBundle) v);
+ } else if (v instanceof Size) {
+ writeInt(VAL_SIZE);
+ writeSize((Size) v);
+ } else if (v instanceof SizeF) {
+ writeInt(VAL_SIZEF);
+ writeSizeF((SizeF) v);
} else {
Class<?> clazz = v.getClass();
if (clazz.isArray() && clazz.getComponentType() == Object.class) {
@@ -1699,6 +1727,24 @@
}
/**
+ * Read a Size from the parcel at the current dataPosition().
+ */
+ public final Size readSize() {
+ final int width = readInt();
+ final int height = readInt();
+ return new Size(width, height);
+ }
+
+ /**
+ * Read a SizeF from the parcel at the current dataPosition().
+ */
+ public final SizeF readSizeF() {
+ final float width = readFloat();
+ final float height = readFloat();
+ return new SizeF(width, height);
+ }
+
+ /**
* Read and return a byte[] object from the parcel.
*/
public final byte[] createByteArray() {
@@ -2160,6 +2206,12 @@
case VAL_PERSISTABLEBUNDLE:
return readPersistableBundle(loader);
+ case VAL_SIZE:
+ return readSize();
+
+ case VAL_SIZEF:
+ return readSizeF();
+
default:
int off = dataPosition() - 4;
throw new RuntimeException(
diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java
index 59220e1..3749892 100644
--- a/core/java/android/os/UserManager.java
+++ b/core/java/android/os/UserManager.java
@@ -660,6 +660,7 @@
try {
Bundle guestRestrictions = mService.getDefaultGuestRestrictions();
guestRestrictions.putBoolean(DISALLOW_SMS, true);
+ guestRestrictions.putBoolean(DISALLOW_INSTALL_UNKNOWN_SOURCES, true);
mService.setUserRestrictions(guestRestrictions, guest.id);
} catch (RemoteException re) {
Log.w(TAG, "Could not update guest restrictions");
diff --git a/core/java/android/util/Size.java b/core/java/android/util/Size.java
index 6424344..62df564 100644
--- a/core/java/android/util/Size.java
+++ b/core/java/android/util/Size.java
@@ -18,13 +18,10 @@
import static com.android.internal.util.Preconditions.checkNotNull;
-import android.os.Parcel;
-import android.os.Parcelable;
-
/**
* Immutable class for describing width and height dimensions in pixels.
*/
-public final class Size implements Parcelable {
+public final class Size {
/**
* Create a new immutable Size instance.
*
@@ -36,11 +33,6 @@
mHeight = height;
}
- private Size(Parcel in) {
- mWidth = in.readInt();
- mHeight = in.readInt();
- }
-
/**
* Get the width of the size (in pixels).
* @return width
@@ -155,29 +147,6 @@
return mHeight ^ ((mWidth << (Integer.SIZE / 2)) | (mWidth >>> (Integer.SIZE / 2)));
}
- @Override
- public int describeContents() {
- return 0;
- }
-
- @Override
- public void writeToParcel(Parcel out, int flags) {
- out.writeInt(mWidth);
- out.writeInt(mHeight);
- }
-
- public static final Parcelable.Creator<Size> CREATOR = new Parcelable.Creator<Size>() {
- @Override
- public Size createFromParcel(Parcel in) {
- return new Size(in);
- }
-
- @Override
- public Size[] newArray(int size) {
- return new Size[size];
- }
- };
-
private final int mWidth;
private final int mHeight;
}
diff --git a/core/java/android/util/SizeF.java b/core/java/android/util/SizeF.java
index 88bb439..ac4f187 100644
--- a/core/java/android/util/SizeF.java
+++ b/core/java/android/util/SizeF.java
@@ -18,9 +18,6 @@
import static com.android.internal.util.Preconditions.checkArgumentFinite;
-import android.os.Parcel;
-import android.os.Parcelable;
-
/**
* Immutable class for describing width and height dimensions in some arbitrary
* unit.
@@ -28,7 +25,7 @@
* Width and height are finite values stored as a floating point representation.
* </p>
*/
-public final class SizeF implements Parcelable {
+public final class SizeF {
/**
* Create a new immutable SizeF instance.
*
@@ -46,11 +43,6 @@
mHeight = checkArgumentFinite(height, "height");
}
- private SizeF(Parcel in) {
- mWidth = in.readFloat();
- mHeight = in.readFloat();
- }
-
/**
* Get the width of the size (as an arbitrary unit).
* @return width
@@ -111,29 +103,6 @@
return Float.floatToIntBits(mWidth) ^ Float.floatToIntBits(mHeight);
}
- @Override
- public int describeContents() {
- return 0;
- }
-
- @Override
- public void writeToParcel(Parcel out, int flags) {
- out.writeFloat(mWidth);
- out.writeFloat(mHeight);
- }
-
- public static final Parcelable.Creator<SizeF> CREATOR = new Parcelable.Creator<SizeF>() {
- @Override
- public SizeF createFromParcel(Parcel in) {
- return new SizeF(in);
- }
-
- @Override
- public SizeF[] newArray(int size) {
- return new SizeF[size];
- }
- };
-
private final float mWidth;
private final float mHeight;
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/LocationTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/LocationTile.java
index 46d8a9b..d1dc5d2 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/LocationTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/LocationTile.java
@@ -60,7 +60,11 @@
@Override
protected void handleUpdateState(BooleanState state, Object arg) {
final boolean locationEnabled = mController.isLocationEnabled();
- state.visible = !(mKeyguard.isSecure() && mKeyguard.isShowing());
+
+ // Work around for bug 15916487: don't show location tile on top of lock screen. After the
+ // bug is fixed, this should be reverted to only hiding it on secure lock screens:
+ // state.visible = !(mKeyguard.isSecure() && mKeyguard.isShowing());
+ state.visible = !mKeyguard.isShowing();
state.value = locationEnabled;
if (locationEnabled) {
state.iconId = R.drawable.ic_qs_location_on;
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index 3e6191c..09584f4 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -3661,11 +3661,15 @@
}
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.MANAGE_USERS, null);
- if (mUserManager.getUserInfo(userHandle) == null) {
+ UserInfo info = mUserManager.getUserInfo(userHandle);
+ if (info == null) {
// User doesn't exist.
throw new IllegalArgumentException(
"Attempted to set profile owner for invalid userId: " + userHandle);
}
+ if (info.isGuest()) {
+ throw new IllegalStateException("Cannot set a profile owner on a guest");
+ }
if (who == null
|| !DeviceOwner.isInstalledForUser(who.getPackageName(), userHandle)) {