diff options
70 files changed, 766 insertions, 1295 deletions
diff --git a/api/current.txt b/api/current.txt index 91f20b7..d3aaf2c 100644 --- a/api/current.txt +++ b/api/current.txt @@ -4515,6 +4515,7 @@ package android.app { ctor public Notification.Action(int, java.lang.CharSequence, android.app.PendingIntent); method public android.app.Notification.Action clone(); method public int describeContents(); + method public android.os.Bundle getExtras(); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator CREATOR; field public android.app.PendingIntent actionIntent; @@ -4522,6 +4523,14 @@ package android.app { field public java.lang.CharSequence title; } + public static class Notification.Action.Builder { + ctor public Notification.Action.Builder(int, java.lang.CharSequence, android.app.PendingIntent); + ctor public Notification.Action.Builder(android.app.Notification.Action); + method public android.app.Notification.Action.Builder addExtras(android.os.Bundle); + method public android.app.Notification.Action build(); + method public android.os.Bundle getExtras(); + } + public static class Notification.BigPictureStyle extends android.app.Notification.Style { ctor public Notification.BigPictureStyle(); ctor public Notification.BigPictureStyle(android.app.Notification.Builder); @@ -4542,6 +4551,7 @@ package android.app { public static class Notification.Builder { ctor public Notification.Builder(android.content.Context); method public android.app.Notification.Builder addAction(int, java.lang.CharSequence, android.app.PendingIntent); + method public android.app.Notification.Builder addAction(android.app.Notification.Action); method public android.app.Notification.Builder addExtras(android.os.Bundle); method public android.app.Notification.Builder addPerson(java.lang.String); method public android.app.Notification build(); @@ -12298,12 +12308,16 @@ package android.hardware.camera2 { field public static final android.hardware.camera2.CameraMetadata.Key TONEMAP_MODE; } +} + +package android.hardware.camera2.params { + public final class ColorSpaceTransform { - ctor public ColorSpaceTransform(android.hardware.camera2.Rational[]); + ctor public ColorSpaceTransform(android.util.Rational[]); ctor public ColorSpaceTransform(int[]); - method public void copyElements(android.hardware.camera2.Rational[], int); + method public void copyElements(android.util.Rational[], int); method public void copyElements(int[], int); - method public android.hardware.camera2.Rational getElement(int, int); + method public android.util.Rational getElement(int, int); } public final class Face { @@ -12323,7 +12337,7 @@ package android.hardware.camera2 { method public int getColumnCount(); method public float getGainFactor(int, int, int); method public int getGainFactorCount(); - method public android.hardware.camera2.RggbChannelVector getGainFactorVector(int, int); + method public android.hardware.camera2.params.RggbChannelVector getGainFactorVector(int, int); method public int getRowCount(); field public static final float MINIMUM_GAIN_FACTOR = 1.0f; } @@ -12332,7 +12346,7 @@ package android.hardware.camera2 { ctor public MeteringRectangle(int, int, int, int, int); ctor public MeteringRectangle(android.graphics.Point, android.util.Size, int); ctor public MeteringRectangle(android.graphics.Rect, int); - method public boolean equals(android.hardware.camera2.MeteringRectangle); + method public boolean equals(android.hardware.camera2.params.MeteringRectangle); method public int getHeight(); method public int getMeteringWeight(); method public android.graphics.Rect getRect(); @@ -12343,12 +12357,6 @@ package android.hardware.camera2 { method public int getY(); } - public final class Rational { - ctor public Rational(int, int); - method public int getDenominator(); - method public int getNumerator(); - } - public final class RggbChannelVector { ctor public RggbChannelVector(float, float, float, float); method public void copyTo(float[], int); @@ -12364,10 +12372,17 @@ package android.hardware.camera2 { field public static final int RED = 0; // 0x0 } - public final class Size { - ctor public Size(int, int); - method public final int getHeight(); - method public final int getWidth(); + public final class StreamConfigurationMap { + method public final int[] getOutputFormats(); + method public long getOutputMinFrameDuration(int, android.util.Size); + method public long getOutputMinFrameDuration(java.lang.Class<T>, android.util.Size); + method public android.util.Size[] getOutputSizes(java.lang.Class<T>); + method public android.util.Size[] getOutputSizes(int); + method public long getOutputStallDuration(int, android.util.Size); + method public long getOutputStallDuration(java.lang.Class<T>, android.util.Size); + method public boolean isOutputSupportedFor(int); + method public static boolean isOutputSupportedFor(java.lang.Class<T>); + method public boolean isOutputSupportedFor(android.view.Surface); } public final class TonemapCurve { @@ -12384,23 +12399,6 @@ package android.hardware.camera2 { } -package android.hardware.camera2.params { - - public final class StreamConfigurationMap { - method public final int[] getOutputFormats(); - method public long getOutputMinFrameDuration(int, android.util.Size); - method public long getOutputMinFrameDuration(java.lang.Class<T>, android.util.Size); - method public android.util.Size[] getOutputSizes(java.lang.Class<T>); - method public android.util.Size[] getOutputSizes(int); - method public long getOutputStallDuration(int, android.util.Size); - method public long getOutputStallDuration(java.lang.Class<T>, android.util.Size); - method public boolean isOutputSupportedFor(int); - method public static boolean isOutputSupportedFor(java.lang.Class<T>); - method public boolean isOutputSupportedFor(android.view.Surface); - } - -} - package android.hardware.display { public final class DisplayManager { @@ -29986,6 +29984,12 @@ package android.util { method public T getUpper(); } + public final class Rational { + ctor public Rational(int, int); + method public int getDenominator(); + method public int getNumerator(); + } + public final class Size { ctor public Size(int, int); method public int getHeight(); diff --git a/core/java/android/app/AppOpsManager.java b/core/java/android/app/AppOpsManager.java index d813dab..62c4f0f 100644 --- a/core/java/android/app/AppOpsManager.java +++ b/core/java/android/app/AppOpsManager.java @@ -19,6 +19,7 @@ package android.app; import android.Manifest; import android.os.Binder; import android.os.IBinder; +import android.os.UserManager; import android.util.ArrayMap; import com.android.internal.app.IAppOpsService; import com.android.internal.app.IAppOpsCallback; @@ -412,6 +413,58 @@ public class AppOpsManager { }; /** + * Specifies whether an Op should be restricted by a user restriction. + * Each Op should be filled with a restriction string from UserManager or + * null to specify it is not affected by any user restriction. + */ + private static String[] sOpRestrictions = new String[] { + null, //COARSE_LOCATION + null, //FINE_LOCATION + null, //GPS + null, //VIBRATE + null, //READ_CONTACTS + null, //WRITE_CONTACTS + null, //READ_CALL_LOG + null, //WRITE_CALL_LOG + null, //READ_CALENDAR + null, //WRITE_CALENDAR + null, //WIFI_SCAN + null, //POST_NOTIFICATION + null, //NEIGHBORING_CELLS + null, //CALL_PHONE + null, //READ_SMS + null, //WRITE_SMS + null, //RECEIVE_SMS + null, //RECEIVE_EMERGECY_SMS + null, //RECEIVE_MMS + null, //RECEIVE_WAP_PUSH + null, //SEND_SMS + null, //READ_ICC_SMS + null, //WRITE_ICC_SMS + null, //WRITE_SETTINGS + null, //SYSTEM_ALERT_WINDOW + null, //ACCESS_NOTIFICATIONS + null, //CAMERA + null, //RECORD_AUDIO + null, //PLAY_AUDIO + null, //READ_CLIPBOARD + null, //WRITE_CLIPBOARD + null, //TAKE_MEDIA_BUTTONS + null, //TAKE_AUDIO_FOCUS + null, //AUDIO_MASTER_VOLUME + null, //AUDIO_VOICE_VOLUME + null, //AUDIO_RING_VOLUME + null, //AUDIO_MEDIA_VOLUME + null, //AUDIO_ALARM_VOLUME + null, //AUDIO_NOTIFICATION_VOLUME + null, //AUDIO_BLUETOOTH_VOLUME + null, //WAKE_LOCK + null, //MONITOR_LOCATION + null, //MONITOR_HIGH_POWER_LOCATION + null, //GET_USAGE_STATS + }; + + /** * This specifies the default mode for each operation. */ private static int[] sOpDefaultMode = new int[] { @@ -542,6 +595,10 @@ public class AppOpsManager { throw new IllegalStateException("sOpDisableReset length " + sOpDisableReset.length + " should be " + _NUM_OP); } + if (sOpRestrictions.length != _NUM_OP) { + throw new IllegalStateException("sOpRestrictions length " + sOpRestrictions.length + + " should be " + _NUM_OP); + } for (int i=0; i<_NUM_OP; i++) { if (sOpToString[i] != null) { sOpStrToOp.put(sOpToString[i], i); @@ -575,6 +632,14 @@ public class AppOpsManager { } /** + * Retrieve the user restriction associated with an operation, or null if there is not one. + * @hide + */ + public static String opToRestriction(int op) { + return sOpRestrictions[op]; + } + + /** * Retrieve the default mode for the operation. * @hide */ diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java index b4d8942..eeb5283 100644 --- a/core/java/android/app/ContextImpl.java +++ b/core/java/android/app/ContextImpl.java @@ -1345,6 +1345,15 @@ class ContextImpl extends Context { public void sendOrderedBroadcastAsUser(Intent intent, UserHandle user, String receiverPermission, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, Bundle initialExtras) { + sendOrderedBroadcastAsUser(intent, user, receiverPermission, AppOpsManager.OP_NONE, + resultReceiver, scheduler, initialCode, initialData, initialExtras); + } + + @Override + public void sendOrderedBroadcastAsUser(Intent intent, UserHandle user, + String receiverPermission, int appOp, BroadcastReceiver resultReceiver, + Handler scheduler, + int initialCode, String initialData, Bundle initialExtras) { IIntentReceiver rd = null; if (resultReceiver != null) { if (mPackageInfo != null) { diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 76a6a8e..fd76b9c4 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -16,9 +16,6 @@ package android.app; -import com.android.internal.R; -import com.android.internal.util.NotificationColorUtil; - import android.annotation.IntDef; import android.content.Context; import android.content.Intent; @@ -41,6 +38,9 @@ import android.view.View; import android.widget.ProgressBar; import android.widget.RemoteViews; +import com.android.internal.R; +import com.android.internal.util.NotificationColorUtil; + import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.text.NumberFormat; @@ -134,7 +134,7 @@ public class Notification implements Parcelable * leave it at its default value of 0. * * @see android.widget.ImageView#setImageLevel - * @see android.graphics.drawable#setLevel + * @see android.graphics.drawable.Drawable#setLevel */ public int iconLevel; @@ -700,10 +700,13 @@ public class Notification implements Parcelable * It must include an icon, a label, and a {@link PendingIntent} to be fired when the action is * selected by the user. * <p> - * Apps should use {@link Builder#addAction(int, CharSequence, PendingIntent)} to create and - * attach actions. + * Apps should use {@link Notification.Builder#addAction(int, CharSequence, PendingIntent)} + * or {@link Notification.Builder#addAction(Notification.Action)} + * to attach actions. */ public static class Action implements Parcelable { + private final Bundle mExtras; + /** * Small icon representing the action. */ @@ -717,22 +720,102 @@ public class Notification implements Parcelable * may be rendered in a disabled presentation by the system UI. */ public PendingIntent actionIntent; - - private Action() { } + private Action(Parcel in) { icon = in.readInt(); title = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in); if (in.readInt() == 1) { actionIntent = PendingIntent.CREATOR.createFromParcel(in); } + mExtras = in.readBundle(); } /** - * Use {@link Builder#addAction(int, CharSequence, PendingIntent)}. + * Use {@link Notification.Builder#addAction(int, CharSequence, PendingIntent)}. */ public Action(int icon, CharSequence title, PendingIntent intent) { + this(icon, title, intent, new Bundle()); + } + + private Action(int icon, CharSequence title, PendingIntent intent, Bundle extras) { this.icon = icon; this.title = title; this.actionIntent = intent; + this.mExtras = extras != null ? extras : new Bundle(); + } + + /** + * Get additional metadata carried around with this Action. + */ + public Bundle getExtras() { + return mExtras; + } + + /** + * Builder class for {@link Action} objects. + */ + public static class Builder { + private final int mIcon; + private final CharSequence mTitle; + private final PendingIntent mIntent; + private final Bundle mExtras; + + /** + * Construct a new builder for {@link Action} object. + * @param icon icon to show for this action + * @param title the title of the action + * @param intent the {@link PendingIntent} to fire when users trigger this action + */ + public Builder(int icon, CharSequence title, PendingIntent intent) { + this(icon, title, intent, new Bundle()); + } + + /** + * Construct a new builder for {@link Action} object using the fields from an + * {@link Action}. + * @param action the action to read fields from. + */ + public Builder(Action action) { + this(action.icon, action.title, action.actionIntent, new Bundle(action.mExtras)); + } + + private Builder(int icon, CharSequence title, PendingIntent intent, Bundle extras) { + mIcon = icon; + mTitle = title; + mIntent = intent; + mExtras = extras; + } + + /** + * Merge additional metadata into this builder. + * + * <p>Values within the Bundle will replace existing extras values in this Builder. + * + * @see Notification.Action#extras + */ + public Builder addExtras(Bundle extras) { + if (extras != null) { + mExtras.putAll(extras); + } + return this; + } + + /** + * Get the metadata Bundle used by this Builder. + * + * <p>The returned Bundle is shared with this Builder. + */ + public Bundle getExtras() { + return mExtras; + } + + /** + * Combine all of the options that have been set and return a new {@link Action} + * object. + * @return the built action + */ + public Action build() { + return new Action(mIcon, mTitle, mIntent, mExtras); + } } @Override @@ -740,8 +823,8 @@ public class Notification implements Parcelable return new Action( this.icon, this.title, - this.actionIntent // safe to alias - ); + this.actionIntent, // safe to alias + new Bundle(this.mExtras)); } @Override public int describeContents() { @@ -757,9 +840,10 @@ public class Notification implements Parcelable } else { out.writeInt(0); } + out.writeBundle(mExtras); } - public static final Parcelable.Creator<Action> CREATOR - = new Parcelable.Creator<Action>() { + public static final Parcelable.Creator<Action> CREATOR = + new Parcelable.Creator<Action>() { public Action createFromParcel(Parcel in) { return new Action(in); } @@ -1372,7 +1456,7 @@ public class Notification implements Parcelable /** * Add a timestamp pertaining to the notification (usually the time the event occurred). * It will be shown in the notification content view by default; use - * {@link Builder#setShowWhen(boolean) setShowWhen} to control this. + * {@link #setShowWhen(boolean) setShowWhen} to control this. * * @see Notification#when */ @@ -1382,7 +1466,7 @@ public class Notification implements Parcelable } /** - * Control whether the timestamp set with {@link Builder#setWhen(long) setWhen} is shown + * Control whether the timestamp set with {@link #setWhen(long) setWhen} is shown * in the content view. */ public Builder setShowWhen(boolean show) { @@ -1761,11 +1845,13 @@ public class Notification implements Parcelable * * @see Notification#extras */ - public Builder addExtras(Bundle bag) { - if (mExtras == null) { - mExtras = new Bundle(bag); - } else { - mExtras.putAll(bag); + public Builder addExtras(Bundle extras) { + if (extras != null) { + if (mExtras == null) { + mExtras = new Bundle(extras); + } else { + mExtras.putAll(extras); + } } return this; } @@ -1782,8 +1868,8 @@ public class Notification implements Parcelable * * @see Notification#extras */ - public Builder setExtras(Bundle bag) { - mExtras = bag; + public Builder setExtras(Bundle extras) { + mExtras = extras; return this; } @@ -1827,6 +1913,26 @@ public class Notification implements Parcelable } /** + * Add an action to this notification. Actions are typically displayed by + * the system as a button adjacent to the notification content. + * <p> + * Every action must have an icon (32dp square and matching the + * <a href="{@docRoot}design/style/iconography.html#action-bar">Holo + * Dark action bar</a> visual style), a textual label, and a {@link PendingIntent}. + * <p> + * A notification in its expanded form can display up to 3 actions, from left to right in + * the order they were added. Actions will not be displayed when the notification is + * collapsed, however, so be sure that any essential functions may be accessed by the user + * in some other way (for example, in the Activity pointed to by {@link #contentIntent}). + * + * @param action The action to add. + */ + public Builder addAction(Action action) { + mActions.add(action); + return this; + } + + /** * Add a rich notification style to be applied at build time. * * @param style Object responsible for modifying the notification style. @@ -1889,26 +1995,20 @@ public class Notification implements Parcelable RemoteViews contentView = new RemoteViews(mContext.getPackageName(), resId); boolean showLine3 = false; boolean showLine2 = false; - int smallIconImageViewId = R.id.icon; + if (mPriority < PRIORITY_LOW) { // TODO: Low priority presentation } if (mLargeIcon != null) { contentView.setImageViewBitmap(R.id.icon, mLargeIcon); processLargeIcon(mLargeIcon, contentView); - smallIconImageViewId = R.id.right_icon; - } - if (mSmallIcon != 0) { - contentView.setImageViewResource(smallIconImageViewId, mSmallIcon); - contentView.setViewVisibility(smallIconImageViewId, View.VISIBLE); - if (mLargeIcon != null) { - processSmallRightIcon(mSmallIcon, smallIconImageViewId, contentView); - } else { - processSmallIconAsLarge(mSmallIcon, contentView); - } - - } else { - contentView.setViewVisibility(smallIconImageViewId, View.GONE); + contentView.setImageViewResource(R.id.right_icon, mSmallIcon); + contentView.setViewVisibility(R.id.right_icon, View.VISIBLE); + processSmallRightIcon(mSmallIcon, contentView); + } else { // small icon at left + contentView.setImageViewResource(R.id.icon, mSmallIcon); + contentView.setViewVisibility(R.id.icon, View.VISIBLE); + processSmallIconAsLarge(mSmallIcon, contentView); } if (mContentTitle != null) { contentView.setTextViewText(R.id.title, processLegacyText(mContentTitle)); @@ -2103,6 +2203,8 @@ public class Notification implements Parcelable private void processLargeIcon(Bitmap largeIcon, RemoteViews contentView) { if (!isLegacy() || mColorUtil.isGrayscale(largeIcon)) { applyLargeIconBackground(contentView); + } else { + removeLargeIconBackground(contentView); } } @@ -2122,16 +2224,31 @@ public class Notification implements Parcelable -1); } + private void removeLargeIconBackground(RemoteViews contentView) { + contentView.setInt(R.id.icon, "setBackgroundResource", 0); + } + /** * Recolor small icons when used in the R.id.right_icon slot. */ - private void processSmallRightIcon(int smallIconDrawableId, int smallIconImageViewId, + private void processSmallRightIcon(int smallIconDrawableId, RemoteViews contentView) { if (!isLegacy() || mColorUtil.isGrayscale(mContext, smallIconDrawableId)) { - contentView.setDrawableParameters(smallIconImageViewId, false, -1, - mContext.getResources().getColor( - R.color.notification_action_legacy_color_filter), - PorterDuff.Mode.MULTIPLY, -1); + contentView.setDrawableParameters(R.id.right_icon, false, -1, + 0xFFFFFFFF, + PorterDuff.Mode.SRC_ATOP, -1); + + contentView.setInt(R.id.right_icon, + "setBackgroundResource", + R.drawable.notification_icon_legacy_bg); + + contentView.setDrawableParameters( + R.id.right_icon, + true, + -1, + mColor, + PorterDuff.Mode.SRC_ATOP, + -1); } } diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index a059e48..a364e68 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -1499,6 +1499,17 @@ public abstract class Context { @Nullable Bundle initialExtras); /** + * Similar to above but takes an appOp as well, to enforce restrictions. + * @see #sendOrderedBroadcastAsUser(Intent, UserHandle, String, + * BroadcastReceiver, Handler, int, String, Bundle) + * @hide + */ + public abstract void sendOrderedBroadcastAsUser(Intent intent, UserHandle user, + @Nullable String receiverPermission, int appOp, BroadcastReceiver resultReceiver, + @Nullable Handler scheduler, int initialCode, @Nullable String initialData, + @Nullable Bundle initialExtras); + + /** * Perform a {@link #sendBroadcast(Intent)} that is "sticky," meaning the * Intent you are sending stays around after the broadcast is complete, * so that others can quickly retrieve that data through the return diff --git a/core/java/android/content/ContextWrapper.java b/core/java/android/content/ContextWrapper.java index 93f6cdf..c66355b 100644 --- a/core/java/android/content/ContextWrapper.java +++ b/core/java/android/content/ContextWrapper.java @@ -418,6 +418,16 @@ public class ContextWrapper extends Context { scheduler, initialCode, initialData, initialExtras); } + /** @hide */ + @Override + public void sendOrderedBroadcastAsUser(Intent intent, UserHandle user, + String receiverPermission, int appOp, BroadcastReceiver resultReceiver, + Handler scheduler, + int initialCode, String initialData, Bundle initialExtras) { + mBase.sendOrderedBroadcastAsUser(intent, user, receiverPermission, appOp, resultReceiver, + scheduler, initialCode, initialData, initialExtras); + } + @Override public void sendStickyBroadcast(Intent intent) { mBase.sendStickyBroadcast(intent); diff --git a/core/java/android/database/CursorWindow.java b/core/java/android/database/CursorWindow.java index 197e3ff..a75372f 100644 --- a/core/java/android/database/CursorWindow.java +++ b/core/java/android/database/CursorWindow.java @@ -42,12 +42,8 @@ import android.util.LongSparseArray; public class CursorWindow extends SQLiteClosable implements Parcelable { private static final String STATS_TAG = "CursorWindowStats"; - /** The cursor window size. resource xml file specifies the value in kB. - * convert it to bytes here by multiplying with 1024. - */ - private static final int sCursorWindowSize = - Resources.getSystem().getInteger( - com.android.internal.R.integer.config_cursorWindowSize) * 1024; + // This static member will be evaluated when first used. + private static int sCursorWindowSize = -1; /** * The native CursorWindow object pointer. (FOR INTERNAL USE ONLY) @@ -100,6 +96,13 @@ public class CursorWindow extends SQLiteClosable implements Parcelable { public CursorWindow(String name) { mStartPos = 0; mName = name != null && name.length() != 0 ? name : "<unnamed>"; + if (sCursorWindowSize < 0) { + /** The cursor window size. resource xml file specifies the value in kB. + * convert it to bytes here by multiplying with 1024. + */ + sCursorWindowSize = Resources.getSystem().getInteger( + com.android.internal.R.integer.config_cursorWindowSize) * 1024; + } mWindowPtr = nativeCreate(mName, sCursorWindowSize); if (mWindowPtr == 0) { throw new CursorWindowAllocationException("Cursor window allocation of " + diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java index b1c1005..1127fe5 100644 --- a/core/java/android/hardware/camera2/CameraCharacteristics.java +++ b/core/java/android/hardware/camera2/CameraCharacteristics.java @@ -17,6 +17,7 @@ package android.hardware.camera2; import android.hardware.camera2.impl.CameraMetadataNative; +import android.util.Rational; import java.util.Collections; import java.util.List; @@ -316,8 +317,8 @@ public final class CameraCharacteristics extends CameraMetadata { * <li>All non (0, 0) sizes will have non-zero widths and heights.</li> * </ul> */ - public static final Key<android.hardware.camera2.Size[]> JPEG_AVAILABLE_THUMBNAIL_SIZES = - new Key<android.hardware.camera2.Size[]>("android.jpeg.availableThumbnailSizes", android.hardware.camera2.Size[].class); + public static final Key<android.util.Size[]> JPEG_AVAILABLE_THUMBNAIL_SIZES = + new Key<android.util.Size[]>("android.jpeg.availableThumbnailSizes", android.util.Size[].class); /** * <p>List of supported aperture @@ -393,8 +394,8 @@ public final class CameraCharacteristics extends CameraMetadata { * <p>The map should be on the order of 30-40 rows and columns, and * must be smaller than 64x64.</p> */ - public static final Key<android.hardware.camera2.Size> LENS_INFO_SHADING_MAP_SIZE = - new Key<android.hardware.camera2.Size>("android.lens.info.shadingMapSize", android.hardware.camera2.Size.class); + public static final Key<android.util.Size> LENS_INFO_SHADING_MAP_SIZE = + new Key<android.util.Size>("android.lens.info.shadingMapSize", android.util.Size.class); /** * <p>The lens focus distance calibration quality.</p> @@ -658,8 +659,8 @@ public final class CameraCharacteristics extends CameraMetadata { * @hide */ @Deprecated - public static final Key<android.hardware.camera2.Size[]> SCALER_AVAILABLE_JPEG_SIZES = - new Key<android.hardware.camera2.Size[]>("android.scaler.availableJpegSizes", android.hardware.camera2.Size[].class); + public static final Key<android.util.Size[]> SCALER_AVAILABLE_JPEG_SIZES = + new Key<android.util.Size[]>("android.scaler.availableJpegSizes", android.util.Size[].class); /** * <p>The maximum ratio between active area width @@ -704,8 +705,8 @@ public final class CameraCharacteristics extends CameraMetadata { * @hide */ @Deprecated - public static final Key<android.hardware.camera2.Size[]> SCALER_AVAILABLE_PROCESSED_SIZES = - new Key<android.hardware.camera2.Size[]>("android.scaler.availableProcessedSizes", android.hardware.camera2.Size[].class); + public static final Key<android.util.Size[]> SCALER_AVAILABLE_PROCESSED_SIZES = + new Key<android.util.Size[]>("android.scaler.availableProcessedSizes", android.util.Size[].class); /** * <p>The mapping of image formats that are supported by this @@ -961,9 +962,6 @@ public final class CameraCharacteristics extends CameraMetadata { * can provide.</p> * <p>Please reference the documentation for the image data destination to * check if it limits the maximum size for image data.</p> - * <p>Not all output formats may be supported in a configuration with - * an input stream of a particular format. For more details, see - * android.scaler.availableInputOutputFormatsMap.</p> * <p>The following table describes the minimum required output stream * configurations based on the hardware level * ({@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel}):</p> @@ -1106,8 +1104,8 @@ public final class CameraCharacteristics extends CameraMetadata { * match this in * android.scaler.availableStreamConfigurations.</p> */ - public static final Key<android.hardware.camera2.Size> SENSOR_INFO_PIXEL_ARRAY_SIZE = - new Key<android.hardware.camera2.Size>("android.sensor.info.pixelArraySize", android.hardware.camera2.Size.class); + public static final Key<android.util.Size> SENSOR_INFO_PIXEL_ARRAY_SIZE = + new Key<android.util.Size>("android.sensor.info.pixelArraySize", android.util.Size.class); /** * <p>Maximum raw value output by sensor.</p> @@ -1515,13 +1513,4 @@ public final class CameraCharacteristics extends CameraMetadata { /*~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~ * End generated code *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~O@*/ - - - - - - - - - } diff --git a/core/java/android/hardware/camera2/CaptureRequest.java b/core/java/android/hardware/camera2/CaptureRequest.java index 8ae21f3..a70aa3b 100644 --- a/core/java/android/hardware/camera2/CaptureRequest.java +++ b/core/java/android/hardware/camera2/CaptureRequest.java @@ -19,6 +19,7 @@ package android.hardware.camera2; import android.hardware.camera2.impl.CameraMetadataNative; import android.os.Parcel; import android.os.Parcelable; +import android.util.Rational; import android.view.Surface; import java.util.HashSet; @@ -169,7 +170,7 @@ public final class CaptureRequest extends CameraMetadata implements Parcelable { * @param in The parcel from which the object should be read * @hide */ - public void readFromParcel(Parcel in) { + private void readFromParcel(Parcel in) { mSettings.readFromParcel(in); mSurfaceSet.clear(); @@ -965,8 +966,8 @@ public final class CaptureRequest extends CameraMetadata implements Parcelable { * <p>When a jpeg image capture is issued, the thumbnail size selected should have * the same aspect ratio as the jpeg image.</p> */ - public static final Key<android.hardware.camera2.Size> JPEG_THUMBNAIL_SIZE = - new Key<android.hardware.camera2.Size>("android.jpeg.thumbnailSize", android.hardware.camera2.Size.class); + public static final Key<android.util.Size> JPEG_THUMBNAIL_SIZE = + new Key<android.util.Size>("android.jpeg.thumbnailSize", android.util.Size.class); /** * <p>The ratio of lens focal length to the effective @@ -1518,12 +1519,4 @@ public final class CaptureRequest extends CameraMetadata implements Parcelable { /*~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~ * End generated code *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~O@*/ - - - - - - - - } diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java index 0160622..d79f4b0 100644 --- a/core/java/android/hardware/camera2/CaptureResult.java +++ b/core/java/android/hardware/camera2/CaptureResult.java @@ -17,6 +17,8 @@ package android.hardware.camera2; import android.hardware.camera2.impl.CameraMetadataNative; +import android.hardware.camera2.params.Face; +import android.util.Rational; /** * <p>The results of a single image capture from the image sensor.</p> @@ -1512,8 +1514,8 @@ public final class CaptureResult extends CameraMetadata { * <p>When a jpeg image capture is issued, the thumbnail size selected should have * the same aspect ratio as the jpeg image.</p> */ - public static final Key<android.hardware.camera2.Size> JPEG_THUMBNAIL_SIZE = - new Key<android.hardware.camera2.Size>("android.jpeg.thumbnailSize", android.hardware.camera2.Size.class); + public static final Key<android.util.Size> JPEG_THUMBNAIL_SIZE = + new Key<android.util.Size>("android.jpeg.thumbnailSize", android.util.Size.class); /** * <p>The ratio of lens focal length to the effective @@ -2060,6 +2062,16 @@ public final class CaptureResult extends CameraMetadata { new Key<byte[]>("android.statistics.faceScores", byte[].class); /** + * <p>List of the faces detected through camera face detection + * in this result.</p> + * <p>Only available if {@link CaptureRequest#STATISTICS_FACE_DETECT_MODE android.statistics.faceDetectMode} <code>!=</code> OFF.</p> + * + * @see CaptureRequest#STATISTICS_FACE_DETECT_MODE + */ + public static final Key<android.hardware.camera2.params.Face[]> STATISTICS_FACES = + new Key<android.hardware.camera2.params.Face[]>("android.statistics.faces", android.hardware.camera2.params.Face[].class); + + /** * <p>The shading map is a low-resolution floating-point map * that lists the coefficients used to correct for vignetting, for each * Bayer color channel.</p> @@ -2425,27 +2437,4 @@ public final class CaptureResult extends CameraMetadata { /*~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~ * End generated code *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~O@*/ - - - - - - - - - - /** - * <p> - * List of the {@link Face Faces} detected through camera face detection - * in this result. - * </p> - * <p> - * Only available if {@link #STATISTICS_FACE_DETECT_MODE} {@code !=} - * {@link CameraMetadata#STATISTICS_FACE_DETECT_MODE_OFF OFF}. - * </p> - * - * @see Face - */ - public static final Key<Face[]> STATISTICS_FACES = - new Key<Face[]>("android.statistics.faces", Face[].class); } diff --git a/core/java/android/hardware/camera2/ICameraDeviceCallbacks.aidl b/core/java/android/hardware/camera2/ICameraDeviceCallbacks.aidl index a14d38b..caabed3 100644 --- a/core/java/android/hardware/camera2/ICameraDeviceCallbacks.aidl +++ b/core/java/android/hardware/camera2/ICameraDeviceCallbacks.aidl @@ -17,7 +17,7 @@ package android.hardware.camera2; import android.hardware.camera2.impl.CameraMetadataNative; -import android.hardware.camera2.CaptureResultExtras; +import android.hardware.camera2.impl.CaptureResultExtras; /** @hide */ interface ICameraDeviceCallbacks diff --git a/core/java/android/hardware/camera2/Size.java b/core/java/android/hardware/camera2/Size.java deleted file mode 100644 index 9328a003..0000000 --- a/core/java/android/hardware/camera2/Size.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (C) 2013 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.hardware.camera2; - -// TODO: Delete this class, since it was moved to android.util as public API - -/** - * Immutable class for describing width and height dimensions in pixels. - * - * @hide - */ -public final class Size { - /** - * Create a new immutable Size instance. - * - * @param width The width of the size, in pixels - * @param height The height of the size, in pixels - */ - public Size(final int width, final int height) { - mWidth = width; - mHeight = height; - } - - /** - * Get the width of the size (in pixels). - * @return width - */ - public final int getWidth() { - return mWidth; - } - - /** - * Get the height of the size (in pixels). - * @return height - */ - public final int getHeight() { - return mHeight; - } - - /** - * Check if this size is equal to another size. - * <p> - * Two sizes are equal if and only if both their widths and heights are - * equal. - * </p> - * <p> - * A size object is never equal to any other type of object. - * </p> - * - * @return {@code true} if the objects were equal, {@code false} otherwise - */ - @Override - public boolean equals(final Object obj) { - if (obj == null) { - return false; - } - if (this == obj) { - return true; - } - if (obj instanceof Size) { - final Size other = (Size) obj; - return mWidth == other.mWidth && mHeight == other.mHeight; - } - return false; - } - - /** - * Return the size represented as a string with the format {@code "WxH"} - * - * @return string representation of the size - */ - @Override - public String toString() { - return mWidth + "x" + mHeight; - } - - /** - * {@inheritDoc} - */ - @Override - public int hashCode() { - // assuming most sizes are <2^16, doing a rotate will give us perfect hashing - return mHeight ^ ((mWidth << (Integer.SIZE / 2)) | (mWidth >>> (Integer.SIZE / 2))); - } - - private final int mWidth; - private final int mHeight; -}; diff --git a/core/java/android/hardware/camera2/impl/CameraDevice.java b/core/java/android/hardware/camera2/impl/CameraDevice.java index 628d1c3..dba24a1 100644 --- a/core/java/android/hardware/camera2/impl/CameraDevice.java +++ b/core/java/android/hardware/camera2/impl/CameraDevice.java @@ -21,7 +21,6 @@ import static android.hardware.camera2.CameraAccessException.CAMERA_IN_USE; import android.hardware.camera2.CameraAccessException; import android.hardware.camera2.CaptureRequest; import android.hardware.camera2.CaptureResult; -import android.hardware.camera2.CaptureResultExtras; import android.hardware.camera2.ICameraDeviceCallbacks; import android.hardware.camera2.ICameraDeviceUser; import android.hardware.camera2.utils.CameraBinderDecorator; diff --git a/core/java/android/hardware/camera2/impl/CameraMetadataNative.java b/core/java/android/hardware/camera2/impl/CameraMetadataNative.java index d28f7bd..db7486d 100644 --- a/core/java/android/hardware/camera2/impl/CameraMetadataNative.java +++ b/core/java/android/hardware/camera2/impl/CameraMetadataNative.java @@ -22,7 +22,6 @@ import android.graphics.Rect; import android.hardware.camera2.CameraCharacteristics; import android.hardware.camera2.CameraMetadata; import android.hardware.camera2.CaptureResult; -import android.hardware.camera2.Face; import android.hardware.camera2.marshal.Marshaler; import android.hardware.camera2.marshal.MarshalQueryable; import android.hardware.camera2.marshal.MarshalRegistry; @@ -43,6 +42,7 @@ import android.hardware.camera2.marshal.impl.MarshalQueryableSizeF; import android.hardware.camera2.marshal.impl.MarshalQueryableStreamConfiguration; import android.hardware.camera2.marshal.impl.MarshalQueryableStreamConfigurationDuration; import android.hardware.camera2.marshal.impl.MarshalQueryableString; +import android.hardware.camera2.params.Face; import android.hardware.camera2.params.StreamConfiguration; import android.hardware.camera2.params.StreamConfigurationDuration; import android.hardware.camera2.params.StreamConfigurationMap; diff --git a/core/java/android/hardware/camera2/CaptureResultExtras.aidl b/core/java/android/hardware/camera2/impl/CaptureResultExtras.aidl index 6587f02..ebc812a 100644 --- a/core/java/android/hardware/camera2/CaptureResultExtras.aidl +++ b/core/java/android/hardware/camera2/impl/CaptureResultExtras.aidl @@ -14,7 +14,7 @@ * limitations under the License. */ -package android.hardware.camera2; +package android.hardware.camera2.impl; /** @hide */ parcelable CaptureResultExtras; diff --git a/core/java/android/hardware/camera2/CaptureResultExtras.java b/core/java/android/hardware/camera2/impl/CaptureResultExtras.java index e5c2c1c..b3a9559 100644 --- a/core/java/android/hardware/camera2/CaptureResultExtras.java +++ b/core/java/android/hardware/camera2/impl/CaptureResultExtras.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package android.hardware.camera2; +package android.hardware.camera2.impl; import android.os.Parcel; import android.os.Parcelable; diff --git a/core/java/android/hardware/camera2/marshal/MarshalHelpers.java b/core/java/android/hardware/camera2/marshal/MarshalHelpers.java index fd72ee2..35ecc2a 100644 --- a/core/java/android/hardware/camera2/marshal/MarshalHelpers.java +++ b/core/java/android/hardware/camera2/marshal/MarshalHelpers.java @@ -18,8 +18,8 @@ package android.hardware.camera2.marshal; import static android.hardware.camera2.impl.CameraMetadataNative.*; import static com.android.internal.util.Preconditions.*; -import android.hardware.camera2.Rational; import android.hardware.camera2.impl.CameraMetadataNative; +import android.util.Rational; /** * Static functions in order to help implementing various marshaler functionality. diff --git a/core/java/android/hardware/camera2/marshal/impl/MarshalQueryableColorSpaceTransform.java b/core/java/android/hardware/camera2/marshal/impl/MarshalQueryableColorSpaceTransform.java index d3796db..47f79bf 100644 --- a/core/java/android/hardware/camera2/marshal/impl/MarshalQueryableColorSpaceTransform.java +++ b/core/java/android/hardware/camera2/marshal/impl/MarshalQueryableColorSpaceTransform.java @@ -15,9 +15,9 @@ */ package android.hardware.camera2.marshal.impl; -import android.hardware.camera2.ColorSpaceTransform; import android.hardware.camera2.marshal.Marshaler; import android.hardware.camera2.marshal.MarshalQueryable; +import android.hardware.camera2.params.ColorSpaceTransform; import android.hardware.camera2.utils.TypeReference; import java.nio.ByteBuffer; diff --git a/core/java/android/hardware/camera2/marshal/impl/MarshalQueryableMeteringRectangle.java b/core/java/android/hardware/camera2/marshal/impl/MarshalQueryableMeteringRectangle.java index c8b9bd8..01780db 100644 --- a/core/java/android/hardware/camera2/marshal/impl/MarshalQueryableMeteringRectangle.java +++ b/core/java/android/hardware/camera2/marshal/impl/MarshalQueryableMeteringRectangle.java @@ -15,9 +15,9 @@ */ package android.hardware.camera2.marshal.impl; -import android.hardware.camera2.MeteringRectangle; import android.hardware.camera2.marshal.Marshaler; import android.hardware.camera2.marshal.MarshalQueryable; +import android.hardware.camera2.params.MeteringRectangle; import android.hardware.camera2.utils.TypeReference; import java.nio.ByteBuffer; diff --git a/core/java/android/hardware/camera2/marshal/impl/MarshalQueryablePrimitive.java b/core/java/android/hardware/camera2/marshal/impl/MarshalQueryablePrimitive.java index 708da70..189b597 100644 --- a/core/java/android/hardware/camera2/marshal/impl/MarshalQueryablePrimitive.java +++ b/core/java/android/hardware/camera2/marshal/impl/MarshalQueryablePrimitive.java @@ -15,11 +15,11 @@ */ package android.hardware.camera2.marshal.impl; -import android.hardware.camera2.Rational; import android.hardware.camera2.impl.CameraMetadataNative; import android.hardware.camera2.marshal.Marshaler; import android.hardware.camera2.marshal.MarshalQueryable; import android.hardware.camera2.utils.TypeReference; +import android.util.Rational; import static android.hardware.camera2.impl.CameraMetadataNative.*; import static android.hardware.camera2.marshal.MarshalHelpers.*; diff --git a/core/java/android/hardware/camera2/marshal/impl/MarshalQueryableRggbChannelVector.java b/core/java/android/hardware/camera2/marshal/impl/MarshalQueryableRggbChannelVector.java index 93c0e92..4253a0a 100644 --- a/core/java/android/hardware/camera2/marshal/impl/MarshalQueryableRggbChannelVector.java +++ b/core/java/android/hardware/camera2/marshal/impl/MarshalQueryableRggbChannelVector.java @@ -15,9 +15,9 @@ */ package android.hardware.camera2.marshal.impl; -import android.hardware.camera2.RggbChannelVector; import android.hardware.camera2.marshal.Marshaler; import android.hardware.camera2.marshal.MarshalQueryable; +import android.hardware.camera2.params.RggbChannelVector; import android.hardware.camera2.utils.TypeReference; import java.nio.ByteBuffer; diff --git a/core/java/android/hardware/camera2/marshal/impl/MarshalQueryableSize.java b/core/java/android/hardware/camera2/marshal/impl/MarshalQueryableSize.java index 6a73bee..721644e 100644 --- a/core/java/android/hardware/camera2/marshal/impl/MarshalQueryableSize.java +++ b/core/java/android/hardware/camera2/marshal/impl/MarshalQueryableSize.java @@ -15,7 +15,7 @@ */ package android.hardware.camera2.marshal.impl; -import android.hardware.camera2.Size; +import android.util.Size; import android.hardware.camera2.marshal.Marshaler; import android.hardware.camera2.marshal.MarshalQueryable; import android.hardware.camera2.utils.TypeReference; diff --git a/core/java/android/hardware/camera2/ColorSpaceTransform.java b/core/java/android/hardware/camera2/params/ColorSpaceTransform.java index 5e4c0a2..fa8c8ea 100644 --- a/core/java/android/hardware/camera2/ColorSpaceTransform.java +++ b/core/java/android/hardware/camera2/params/ColorSpaceTransform.java @@ -14,11 +14,13 @@ * limitations under the License. */ -package android.hardware.camera2; +package android.hardware.camera2.params; import static com.android.internal.util.Preconditions.*; +import android.hardware.camera2.CameraMetadata; import android.hardware.camera2.utils.HashCodeHelpers; +import android.util.Rational; import java.util.Arrays; diff --git a/core/java/android/hardware/camera2/Face.java b/core/java/android/hardware/camera2/params/Face.java index ded8839d..2cd83a3 100644 --- a/core/java/android/hardware/camera2/Face.java +++ b/core/java/android/hardware/camera2/params/Face.java @@ -15,10 +15,13 @@ */ -package android.hardware.camera2; +package android.hardware.camera2.params; import android.graphics.Point; import android.graphics.Rect; +import android.hardware.camera2.CameraCharacteristics; +import android.hardware.camera2.CameraMetadata; +import android.hardware.camera2.CaptureResult; /** * Describes a face detected in an image. diff --git a/core/java/android/hardware/camera2/LensShadingMap.java b/core/java/android/hardware/camera2/params/LensShadingMap.java index 2b0108c..b328f57 100644 --- a/core/java/android/hardware/camera2/LensShadingMap.java +++ b/core/java/android/hardware/camera2/params/LensShadingMap.java @@ -14,11 +14,13 @@ * limitations under the License. */ -package android.hardware.camera2; +package android.hardware.camera2.params; import static com.android.internal.util.Preconditions.*; -import static android.hardware.camera2.RggbChannelVector.*; +import static android.hardware.camera2.params.RggbChannelVector.*; +import android.hardware.camera2.CameraCharacteristics; +import android.hardware.camera2.CaptureResult; import android.hardware.camera2.utils.HashCodeHelpers; import java.util.Arrays; diff --git a/core/java/android/hardware/camera2/MeteringRectangle.java b/core/java/android/hardware/camera2/params/MeteringRectangle.java index bb8e5b1..a26c57d 100644 --- a/core/java/android/hardware/camera2/MeteringRectangle.java +++ b/core/java/android/hardware/camera2/params/MeteringRectangle.java @@ -13,13 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package android.hardware.camera2; +package android.hardware.camera2.params; import android.util.Size; import static com.android.internal.util.Preconditions.*; import android.graphics.Point; import android.graphics.Rect; +import android.hardware.camera2.CameraCharacteristics; +import android.hardware.camera2.CaptureRequest; import android.hardware.camera2.utils.HashCodeHelpers; /** diff --git a/core/java/android/hardware/camera2/RggbChannelVector.java b/core/java/android/hardware/camera2/params/RggbChannelVector.java index 80167c6..30591f6 100644 --- a/core/java/android/hardware/camera2/RggbChannelVector.java +++ b/core/java/android/hardware/camera2/params/RggbChannelVector.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package android.hardware.camera2; +package android.hardware.camera2.params; import static com.android.internal.util.Preconditions.*; diff --git a/core/java/android/hardware/camera2/TonemapCurve.java b/core/java/android/hardware/camera2/params/TonemapCurve.java index 2958ebf..0fcffac 100644 --- a/core/java/android/hardware/camera2/TonemapCurve.java +++ b/core/java/android/hardware/camera2/params/TonemapCurve.java @@ -14,11 +14,15 @@ * limitations under the License. */ -package android.hardware.camera2; +package android.hardware.camera2.params; import static com.android.internal.util.Preconditions.*; import android.graphics.PointF; +import android.hardware.camera2.CameraCharacteristics; +import android.hardware.camera2.CameraDevice; +import android.hardware.camera2.CameraMetadata; +import android.hardware.camera2.CaptureRequest; import android.hardware.camera2.utils.HashCodeHelpers; import java.util.Arrays; diff --git a/core/java/android/net/NetworkAgent.java b/core/java/android/net/NetworkAgent.java index 4b85398..c2b06a2 100644 --- a/core/java/android/net/NetworkAgent.java +++ b/core/java/android/net/NetworkAgent.java @@ -66,6 +66,7 @@ public abstract class NetworkAgent extends Handler { private AsyncChannel mAsyncChannel; private final String LOG_TAG; private static final boolean DBG = true; + private static final boolean VDBG = true; // TODO - this class shouldn't cache data or it runs the risk of getting out of sync // Make the API require each of these when any is updated so we have the data we need, // without caching. @@ -266,11 +267,14 @@ public abstract class NetworkAgent extends Handler { */ private void evalScores() { if (mConnectionRequested) { + if (VDBG) log("evalScores - already trying - size=" + mNetworkRequests.size()); // already trying return; } + if (VDBG) log("evalScores!"); for (int i=0; i < mNetworkRequests.size(); i++) { int score = mNetworkRequests.valueAt(i).score; + if (VDBG) log(" checking request Min " + score + " vs my score " + mNetworkScore); if (score < mNetworkScore) { // have a request that has a lower scored network servicing it // (or no network) than we could provide, so lets connect! diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java index cf0caed..af45fa0 100644 --- a/core/java/android/os/BatteryStats.java +++ b/core/java/android/os/BatteryStats.java @@ -531,7 +531,8 @@ public abstract class BatteryStats implements Parcelable { public final static class HistoryItem implements Parcelable { public HistoryItem next; - + + // The time of this event in milliseconds, as per SystemClock.elapsedRealtime(). public long time; public static final byte CMD_UPDATE = 0; // These can be written as deltas @@ -645,7 +646,7 @@ public abstract class BatteryStats implements Parcelable { public int eventCode; public HistoryTag eventTag; - // Only set for CMD_CURRENT_TIME. + // Only set for CMD_CURRENT_TIME or CMD_RESET, as per System.currentTimeMillis(). public long currentTime; // Meta-data when reading. diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index d09bb88..d063168 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -2900,6 +2900,7 @@ public final class Settings { MOVED_TO_GLOBAL.add(Settings.Global.SET_GLOBAL_HTTP_PROXY); MOVED_TO_GLOBAL.add(Settings.Global.DEFAULT_DNS_SERVER); MOVED_TO_GLOBAL.add(Settings.Global.PREFERRED_NETWORK_MODE); + MOVED_TO_GLOBAL.add(Settings.Global.WEBVIEW_DATA_REDUCTION_PROXY_KEY); } /** @hide */ @@ -5330,6 +5331,13 @@ public final class Settings { */ public static final String USE_GOOGLE_MAIL = "use_google_mail"; + /** + * Webview Data reduction proxy key. + * @hide + */ + public static final String WEBVIEW_DATA_REDUCTION_PROXY_KEY = + "webview_data_reduction_proxy_key"; + /** * Whether Wifi display is enabled/disabled * 0=disabled. 1=enabled. diff --git a/core/java/android/service/notification/NotificationListenerService.java b/core/java/android/service/notification/NotificationListenerService.java index a94f45a..e2e9ff4 100644 --- a/core/java/android/service/notification/NotificationListenerService.java +++ b/core/java/android/service/notification/NotificationListenerService.java @@ -16,9 +16,11 @@ package android.service.notification; +import android.annotation.PrivateApi; import android.annotation.SdkConstant; import android.app.INotificationManager; import android.app.Service; +import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.os.IBinder; @@ -26,9 +28,6 @@ import android.os.RemoteException; import android.os.ServiceManager; import android.util.Log; -import java.util.Comparator; -import java.util.HashMap; - /** * A service that receives calls from the system when new notifications are posted or removed. * <p>To extend this class, you must declare the service in your manifest file with @@ -53,6 +52,9 @@ public abstract class NotificationListenerService extends Service { private INotificationManager mNoMan; + /** Only valid after a successful call to (@link registerAsService}. */ + private int mCurrentUser; + /** * The {@link Intent} that must be declared as handled by the service. */ @@ -267,6 +269,42 @@ public abstract class NotificationListenerService extends Service { return true; } + /** + * Directly register this service with the Notification Manager. + * + * <p>Only system services may use this call. It will fail for non-system callers. + * Apps should ask the user to add their listener in Settings. + * + * @param componentName the component that will consume the notification information + * @param currentUser the user to use as the stream filter + * @hide + */ + @PrivateApi + public void registerAsSystemService(ComponentName componentName, int currentUser) + throws RemoteException { + if (mWrapper == null) { + mWrapper = new INotificationListenerWrapper(); + } + INotificationManager noMan = getNotificationInterface(); + noMan.registerListener(mWrapper, componentName, currentUser); + mCurrentUser = currentUser; + } + + /** + * Directly unregister this service from the Notification Manager. + * + * <P>This method will fail for listeners that were not registered + * with (@link registerAsService). + * @hide + */ + @PrivateApi + public void unregisterAsSystemService() throws RemoteException { + if (mWrapper != null) { + INotificationManager noMan = getNotificationInterface(); + noMan.unregisterListener(mWrapper, mCurrentUser); + } + } + private class INotificationListenerWrapper extends INotificationListener.Stub { @Override public void onNotificationPosted(StatusBarNotification sbn, diff --git a/core/java/android/hardware/camera2/Rational.java b/core/java/android/util/Rational.java index 693ee2b..8d4c67f 100644 --- a/core/java/android/hardware/camera2/Rational.java +++ b/core/java/android/util/Rational.java @@ -13,11 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package android.hardware.camera2; +package android.util; /** - * The rational data type used by CameraMetadata keys. Contains a pair of ints representing the - * numerator and denominator of a Rational number. This type is immutable. + * <p>An immutable data type representation a rational number.</p> + * + * <p>Contains a pair of {@code int}s representing the numerator and denominator of a + * Rational number. </p> */ public final class Rational { private final int mNumerator; @@ -30,7 +32,9 @@ public final class Rational { * is always positive.</p> * * <p>A rational value with a 0-denominator may be constructed, but will have similar semantics - * as float NaN and INF values. The int getter functions return 0 in this case.</p> + * as float {@code NaN} and {@code INF} values. For {@code NaN}, + * both {@link #getNumerator} and {@link #getDenominator} functions will return 0. For + * positive or negative {@code INF}, only the {@link #getDenominator} will return 0.</p> * * @param numerator the numerator of the rational * @param denominator the denominator of the rational diff --git a/core/java/android/view/GLRenderer.java b/core/java/android/view/GLRenderer.java index 7b49006..9601a8d 100644 --- a/core/java/android/view/GLRenderer.java +++ b/core/java/android/view/GLRenderer.java @@ -1220,10 +1220,6 @@ public class GLRenderer extends HardwareRenderer { } private RenderNode buildDisplayList(View view, HardwareCanvas canvas) { - if (mDrawDelta <= 0) { - return view.mRenderNode; - } - view.mRecreateDisplayList = (view.mPrivateFlags & View.PFLAG_INVALIDATED) == View.PFLAG_INVALIDATED; view.mPrivateFlags &= ~View.PFLAG_INVALIDATED; diff --git a/core/java/com/android/internal/app/IAppOpsService.aidl b/core/java/com/android/internal/app/IAppOpsService.aidl index cd75010..8e6fa58 100644 --- a/core/java/com/android/internal/app/IAppOpsService.aidl +++ b/core/java/com/android/internal/app/IAppOpsService.aidl @@ -17,6 +17,7 @@ package com.android.internal.app; import android.app.AppOpsManager; +import android.os.Bundle; import com.android.internal.app.IAppOpsCallback; interface IAppOpsService { @@ -38,4 +39,10 @@ interface IAppOpsService { void resetAllModes(); int checkAudioOperation(int code, int stream, int uid, String packageName); void setAudioRestriction(int code, int stream, int uid, int mode, in String[] exceptionPackages); + + void setDeviceOwner(String packageName); + void setProfileOwner(String packageName, int userHandle); + void setUserRestrictions(in Bundle restrictions, int userHandle); + void removeUser(int userHandle); + } diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java index 956c86d..8428f66 100644 --- a/core/java/com/android/internal/os/BatteryStatsImpl.java +++ b/core/java/com/android/internal/os/BatteryStatsImpl.java @@ -235,7 +235,8 @@ public final class BatteryStatsImpl extends BatteryStats { int mWakeLockNesting; boolean mWakeLockImportant; - public boolean mRecordAllWakeLocks; + boolean mRecordAllWakeLocks; + boolean mNoAutoReset; int mScreenState = Display.STATE_UNKNOWN; StopwatchTimer mScreenOnTimer; @@ -2314,9 +2315,6 @@ public final class BatteryStatsImpl extends BatteryStats { } } - private String mInitialAcquireWakeName; - private int mInitialAcquireWakeUid = -1; - public void setRecordAllWakeLocksLocked(boolean enabled) { mRecordAllWakeLocks = enabled; if (!enabled) { @@ -2325,6 +2323,13 @@ public final class BatteryStatsImpl extends BatteryStats { } } + public void setNoAutoReset(boolean enabled) { + mNoAutoReset = enabled; + } + + private String mInitialAcquireWakeName; + private int mInitialAcquireWakeUid = -1; + public void noteStartWakeLocked(int uid, int pid, String name, String historyName, int type, boolean unimportantForLogging, long elapsedRealtime, long uptime) { uid = mapUid(uid); @@ -2355,6 +2360,7 @@ public final class BatteryStatsImpl extends BatteryStats { } else if (mRecordAllWakeLocks) { if (mActiveEvents.updateState(HistoryItem.EVENT_WAKE_LOCK_START, historyName, uid, 0)) { + mWakeLockNesting++; return; } addHistoryEventLocked(elapsedRealtime, uptime, HistoryItem.EVENT_WAKE_LOCK_START, @@ -5942,9 +5948,9 @@ public final class BatteryStatsImpl extends BatteryStats { // we have gone through a significant charge (from a very low // level to a now very high level). boolean reset = false; - if (oldStatus == BatteryManager.BATTERY_STATUS_FULL + if (!mNoAutoReset && (oldStatus == BatteryManager.BATTERY_STATUS_FULL || level >= 90 - || (mDischargeCurrentLevel < 20 && level >= 80)) { + || (mDischargeCurrentLevel < 20 && level >= 80))) { doWrite = true; resetAllStatsLocked(); mDischargeStartLevel = level; diff --git a/core/jni/android/graphics/TextLayoutCache.cpp b/core/jni/android/graphics/TextLayoutCache.cpp index bf58918..9279758 100644 --- a/core/jni/android/graphics/TextLayoutCache.cpp +++ b/core/jni/android/graphics/TextLayoutCache.cpp @@ -367,7 +367,6 @@ void TextLayoutShaper::computeValues(const SkPaint* paint, const UChar* chars, bool forceLTR = false; bool forceRTL = false; - ALOGD("computeValues dirFlags=%d", dirFlags); switch (dirFlags & kBidi_Mask) { case kBidi_LTR: bidiReq = 0; break; // no ICU constant, canonical LTR level case kBidi_RTL: bidiReq = 1; break; // no ICU constant, canonical RTL level diff --git a/core/jni/android_media_AudioTrack.cpp b/core/jni/android_media_AudioTrack.cpp index 463a0a8..5fcb5f3 100644 --- a/core/jni/android_media_AudioTrack.cpp +++ b/core/jni/android_media_AudioTrack.cpp @@ -201,22 +201,6 @@ android_media_AudioTrack_setup(JNIEnv *env, jobject thiz, jobject weak_this, { ALOGV("sampleRate=%d, audioFormat(from Java)=%d, channel mask=%x, buffSize=%d", sampleRateInHertz, audioFormat, javaChannelMask, buffSizeInBytes); - uint32_t afSampleRate; - size_t afFrameCount; - - status_t status = AudioSystem::getOutputFrameCount(&afFrameCount, - (audio_stream_type_t) streamType); - if (status != NO_ERROR) { - ALOGE("Error %d creating AudioTrack: Could not get AudioSystem frame count " - "for stream type %d.", status, streamType); - return (jint) AUDIOTRACK_ERROR_SETUP_AUDIOSYSTEM; - } - status = AudioSystem::getOutputSamplingRate(&afSampleRate, (audio_stream_type_t) streamType); - if (status != NO_ERROR) { - ALOGE("Error %d creating AudioTrack: Could not get AudioSystem sampling rate " - "for stream type %d.", status, streamType); - return (jint) AUDIOTRACK_ERROR_SETUP_AUDIOSYSTEM; - } // Java channel masks don't map directly to the native definition, but it's a simple shift // to skip the two deprecated channel configurations "default" and "mono". @@ -229,23 +213,8 @@ android_media_AudioTrack_setup(JNIEnv *env, jobject thiz, jobject weak_this, uint32_t channelCount = popcount(nativeChannelMask); - // check the stream type - audio_stream_type_t atStreamType; - switch (streamType) { - case AUDIO_STREAM_VOICE_CALL: - case AUDIO_STREAM_SYSTEM: - case AUDIO_STREAM_RING: - case AUDIO_STREAM_MUSIC: - case AUDIO_STREAM_ALARM: - case AUDIO_STREAM_NOTIFICATION: - case AUDIO_STREAM_BLUETOOTH_SCO: - case AUDIO_STREAM_DTMF: - atStreamType = (audio_stream_type_t) streamType; - break; - default: - ALOGE("Error creating AudioTrack: unknown stream type %d.", streamType); - return (jint) AUDIOTRACK_ERROR_SETUP_INVALIDSTREAMTYPE; - } + // stream type already checked in Java + audio_stream_type_t atStreamType = (audio_stream_type_t) streamType; // check the format. // This function was called from Java, so we compare the format against the Java constants @@ -305,6 +274,7 @@ android_media_AudioTrack_setup(JNIEnv *env, jobject thiz, jobject weak_this, lpJniStorage->mCallbackData.busy = false; // initialize the native AudioTrack object + status_t status = NO_ERROR; switch (memoryMode) { case MODE_STREAM: diff --git a/core/res/res/layout/notification_action.xml b/core/res/res/layout/notification_action.xml deleted file mode 100644 index 4e7c74c..0000000 --- a/core/res/res/layout/notification_action.xml +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- 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. ---> - -<Button xmlns:android="http://schemas.android.com/apk/res/android" - style="?android:attr/borderlessButtonStyle" - android:id="@+id/action0" - android:layout_width="0dp" - android:layout_height="48dp" - android:layout_weight="1" - android:gravity="start|center_vertical" - android:drawablePadding="8dp" - android:paddingStart="8dp" - android:textColor="#ccc" - android:textSize="14dp" - android:singleLine="true" - android:ellipsize="end" - /> diff --git a/core/res/res/layout/notification_action_tombstone.xml b/core/res/res/layout/notification_action_tombstone.xml deleted file mode 100644 index 9977cfe..0000000 --- a/core/res/res/layout/notification_action_tombstone.xml +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- 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. ---> - -<Button xmlns:android="http://schemas.android.com/apk/res/android" - style="?android:attr/borderlessButtonStyle" - android:id="@+id/action0" - android:layout_width="0dp" - android:layout_height="48dp" - android:layout_weight="1" - android:gravity="start|center_vertical" - android:drawablePadding="8dp" - android:paddingStart="8dp" - android:textColor="#ccc" - android:textSize="14dp" - android:singleLine="true" - android:ellipsize="end" - android:alpha="0.5" - android:enabled="false" - /> diff --git a/core/res/res/layout/notification_template_base.xml b/core/res/res/layout/notification_template_base.xml deleted file mode 100644 index d2e25c1..0000000 --- a/core/res/res/layout/notification_template_base.xml +++ /dev/null @@ -1,136 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- 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. ---> - -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:internal="http://schemas.android.com/apk/prv/res/android" - android:background="@android:drawable/notification_bg" - android:id="@+id/status_bar_latest_event_content" - android:layout_width="match_parent" - android:layout_height="64dp" - internal:layout_minHeight="64dp" - internal:layout_maxHeight="64dp" - > - <ImageView android:id="@+id/icon" - android:layout_width="@dimen/notification_large_icon_width" - android:layout_height="@dimen/notification_large_icon_height" - android:background="@android:drawable/notification_template_icon_bg" - android:scaleType="center" - /> - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_gravity="fill_vertical" - android:layout_marginStart="@dimen/notification_large_icon_width" - android:minHeight="@dimen/notification_large_icon_height" - android:orientation="vertical" - android:paddingEnd="8dp" - android:paddingTop="2dp" - android:paddingBottom="2dp" - android:gravity="top" - > - <LinearLayout - android:id="@+id/line1" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingTop="6dp" - android:layout_marginStart="8dp" - android:orientation="horizontal" - > - <TextView android:id="@+id/title" - android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Title" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:singleLine="true" - android:ellipsize="marquee" - android:fadingEdge="horizontal" - android:layout_weight="1" - /> - <ViewStub android:id="@+id/time" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_weight="0" - android:visibility="gone" - android:layout="@layout/notification_template_part_time" - /> - <ViewStub android:id="@+id/chronometer" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_weight="0" - android:visibility="gone" - android:layout="@layout/notification_template_part_chronometer" - /> - </LinearLayout> - <TextView android:id="@+id/text2" - android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Line2" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="-2dp" - android:layout_marginBottom="-2dp" - android:layout_marginStart="8dp" - android:singleLine="true" - android:fadingEdge="horizontal" - android:ellipsize="marquee" - android:visibility="gone" - /> - <ProgressBar - android:id="@android:id/progress" - android:layout_width="match_parent" - android:layout_height="12dp" - android:layout_marginStart="8dp" - android:visibility="gone" - style="?android:attr/progressBarStyleHorizontal" - /> - <LinearLayout - android:id="@+id/line3" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal" - android:gravity="center_vertical" - android:layout_marginStart="8dp" - > - <TextView android:id="@+id/text" - android:textAppearance="@style/TextAppearance.StatusBar.EventContent" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="1" - android:layout_gravity="center" - android:singleLine="true" - android:ellipsize="marquee" - android:fadingEdge="horizontal" - /> - <TextView android:id="@+id/info" - android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Info" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:layout_weight="0" - android:singleLine="true" - android:gravity="center" - android:paddingStart="8dp" - /> - <ImageView android:id="@+id/right_icon" - android:layout_width="16dp" - android:layout_height="16dp" - android:layout_gravity="center" - android:layout_weight="0" - android:layout_marginStart="8dp" - android:scaleType="centerInside" - android:visibility="gone" - android:drawableAlpha="153" - /> - </LinearLayout> - </LinearLayout> -</FrameLayout> diff --git a/core/res/res/layout/notification_template_big_base.xml b/core/res/res/layout/notification_template_big_base.xml deleted file mode 100644 index 7cc6650..0000000 --- a/core/res/res/layout/notification_template_big_base.xml +++ /dev/null @@ -1,167 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- 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. ---> - -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:internal="http://schemas.android.com/apk/prv/res/android" - android:background="@android:drawable/notification_bg" - android:id="@+id/status_bar_latest_event_content" - android:layout_width="match_parent" - android:layout_height="wrap_content" - internal:layout_minHeight="65dp" - internal:layout_maxHeight="unbounded" - > - <ImageView android:id="@+id/icon" - android:layout_width="@dimen/notification_large_icon_width" - android:layout_height="@dimen/notification_large_icon_height" - android:background="@android:drawable/notification_template_icon_bg" - android:scaleType="center" - /> - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_gravity="fill_vertical" - android:minHeight="@dimen/notification_large_icon_height" - android:orientation="vertical" - android:gravity="top" - > - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginStart="@dimen/notification_large_icon_width" - android:minHeight="@dimen/notification_large_icon_height" - android:paddingTop="2dp" - android:orientation="vertical" - > - <LinearLayout - android:id="@+id/line1" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingTop="6dp" - android:layout_marginEnd="8dp" - android:layout_marginStart="8dp" - android:orientation="horizontal" - > - <TextView android:id="@+id/title" - android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Title" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:singleLine="true" - android:ellipsize="marquee" - android:fadingEdge="horizontal" - android:layout_weight="1" - /> - <ViewStub android:id="@+id/time" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_weight="0" - android:visibility="gone" - android:layout="@layout/notification_template_part_time" - /> - <ViewStub android:id="@+id/chronometer" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_weight="0" - android:visibility="gone" - android:layout="@layout/notification_template_part_chronometer" - /> - </LinearLayout> - <TextView android:id="@+id/text2" - android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Line2" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="-2dp" - android:layout_marginBottom="-2dp" - android:layout_marginStart="8dp" - android:layout_marginEnd="8dp" - android:singleLine="true" - android:fadingEdge="horizontal" - android:ellipsize="marquee" - android:visibility="gone" - /> - <TextView android:id="@+id/big_text" - android:textAppearance="@style/TextAppearance.StatusBar.EventContent" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginStart="8dp" - android:layout_marginEnd="8dp" - android:singleLine="false" - android:visibility="gone" - /> - <LinearLayout - android:id="@+id/line3" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginStart="8dp" - android:layout_marginEnd="8dp" - android:orientation="horizontal" - android:gravity="center_vertical" - > - <TextView android:id="@+id/text" - android:textAppearance="@style/TextAppearance.StatusBar.EventContent" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="1" - android:layout_gravity="center" - android:singleLine="true" - android:ellipsize="marquee" - android:fadingEdge="horizontal" - /> - <TextView android:id="@+id/info" - android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Info" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:layout_weight="0" - android:singleLine="true" - android:gravity="center" - android:paddingStart="8dp" - /> - <ImageView android:id="@+id/right_icon" - android:layout_width="16dp" - android:layout_height="16dp" - android:layout_gravity="center" - android:layout_weight="0" - android:layout_marginStart="8dp" - android:scaleType="centerInside" - android:visibility="gone" - android:drawableAlpha="153" - /> - </LinearLayout> - <ProgressBar - android:id="@android:id/progress" - android:layout_width="match_parent" - android:layout_height="12dp" - android:layout_marginBottom="8dp" - android:layout_marginStart="8dp" - android:layout_marginEnd="8dp" - android:visibility="gone" - style="?android:attr/progressBarStyleHorizontal" - /> - </LinearLayout> - <ImageView - android:layout_width="match_parent" - android:layout_height="1px" - android:id="@+id/action_divider" - android:visibility="gone" - android:background="?android:attr/dividerHorizontal" /> - <include - layout="@layout/notification_action_list" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginStart="@dimen/notification_large_icon_width" - /> - </LinearLayout> -</FrameLayout> diff --git a/core/res/res/layout/notification_template_big_picture.xml b/core/res/res/layout/notification_template_big_picture.xml deleted file mode 100644 index f3f3951..0000000 --- a/core/res/res/layout/notification_template_big_picture.xml +++ /dev/null @@ -1,61 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- 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. ---> - -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:internal="http://schemas.android.com/apk/prv/res/android" - android:background="@android:drawable/notification_bg" - android:id="@+id/status_bar_latest_event_content" - android:layout_width="match_parent" - android:layout_height="match_parent" - internal:layout_minHeight="65dp" - internal:layout_maxHeight="unbounded" - > - <ImageView - android:id="@+id/big_picture" - android:layout_width="match_parent" - android:layout_height="192dp" - android:layout_marginTop="64dp" - android:layout_gravity="bottom" - android:scaleType="centerCrop" - /> - <ImageView - android:layout_width="match_parent" - android:layout_height="6dp" - android:layout_marginTop="64dp" - android:scaleType="fitXY" - android:src="@drawable/title_bar_shadow" - /> - <include layout="@layout/notification_template_base" - android:layout_width="match_parent" - android:layout_height="wrap_content" - /> - <FrameLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="208dp" - android:paddingStart="64dp" - android:layout_gravity="bottom" - android:background="#CC111111" - > - <include - layout="@layout/notification_action_list" - android:id="@+id/actions" - android:layout_gravity="bottom" - android:layout_width="match_parent" - android:layout_height="wrap_content" - /> - </FrameLayout> -</FrameLayout> diff --git a/core/res/res/layout/notification_template_big_text.xml b/core/res/res/layout/notification_template_big_text.xml deleted file mode 100644 index 7e6da22..0000000 --- a/core/res/res/layout/notification_template_big_text.xml +++ /dev/null @@ -1,183 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- 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. ---> -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:internal="http://schemas.android.com/apk/prv/res/android" - android:background="@android:drawable/notification_bg" - android:id="@+id/status_bar_latest_event_content" - android:layout_width="match_parent" - android:layout_height="wrap_content" - internal:layout_minHeight="65dp" - internal:layout_maxHeight="unbounded" - > - <ImageView android:id="@+id/icon" - android:layout_width="@dimen/notification_large_icon_width" - android:layout_height="@dimen/notification_large_icon_height" - android:background="@android:drawable/notification_template_icon_bg" - android:scaleType="center" - /> - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_gravity="fill_vertical" - android:layout_marginStart="@dimen/notification_large_icon_width" - android:orientation="vertical" - android:paddingTop="0dp" - android:paddingBottom="2dp" - android:gravity="top" - > - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="@dimen/notification_large_icon_height" - android:orientation="vertical" - android:layout_marginStart="8dp" - android:layout_marginEnd="8dp" - android:layout_weight="1" - > - <LinearLayout - android:id="@+id/line1" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingTop="8dp" - android:orientation="horizontal" - android:layout_gravity="top" - android:layout_weight="0" - > - <TextView android:id="@+id/title" - android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Title" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:singleLine="true" - android:ellipsize="marquee" - android:fadingEdge="horizontal" - android:layout_weight="1" - /> - <ViewStub android:id="@+id/time" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_weight="0" - android:visibility="gone" - android:layout="@layout/notification_template_part_time" - /> - <ViewStub android:id="@+id/chronometer" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_weight="0" - android:visibility="gone" - android:layout="@layout/notification_template_part_chronometer" - /> - </LinearLayout> - <TextView android:id="@+id/text2" - android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Line2" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="-2dp" - android:layout_marginBottom="-2dp" - android:layout_marginEnd="8dp" - android:singleLine="true" - android:fadingEdge="horizontal" - android:ellipsize="marquee" - android:layout_weight="0" - android:visibility="gone" - /> - <ProgressBar - android:id="@android:id/progress" - android:layout_width="match_parent" - android:layout_height="12dp" - android:layout_marginBottom="8dp" - android:layout_marginEnd="8dp" - android:visibility="gone" - android:layout_weight="0" - style="?android:attr/progressBarStyleHorizontal" - /> - <TextView android:id="@+id/big_text" - android:textAppearance="@style/TextAppearance.StatusBar.EventContent" - android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_marginBottom="10dp" - android:layout_marginEnd="8dp" - android:singleLine="false" - android:visibility="gone" - android:maxLines="8" - android:ellipsize="end" - android:layout_weight="1" - /> - </LinearLayout> - <ImageView - android:layout_width="match_parent" - android:layout_height="1dip" - android:layout_marginTop="-1px" - android:id="@+id/action_divider" - android:visibility="gone" - android:background="?android:attr/dividerHorizontal" /> - <include - layout="@layout/notification_action_list" - android:layout_width="match_parent" - android:layout_height="0dp" - android:visibility="gone" - android:layout_weight="1" - /> - <ImageView - android:layout_width="match_parent" - android:layout_height="1px" - android:id="@+id/overflow_divider" - android:layout_marginBottom="8dp" - android:visibility="visible" - android:background="?android:attr/dividerHorizontal" /> - <LinearLayout - android:id="@+id/line3" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginStart="8dp" - android:layout_marginBottom="8dp" - android:layout_marginEnd="8dp" - android:orientation="horizontal" - android:layout_weight="0" - android:gravity="center_vertical" - > - <TextView android:id="@+id/text" - android:textAppearance="@style/TextAppearance.StatusBar.EventContent" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="1" - android:layout_gravity="center" - android:singleLine="true" - android:ellipsize="marquee" - android:fadingEdge="horizontal" - /> - <TextView android:id="@+id/info" - android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Info" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:layout_weight="0" - android:singleLine="true" - android:gravity="center" - android:paddingStart="8dp" - /> - <ImageView android:id="@+id/right_icon" - android:layout_width="16dp" - android:layout_height="16dp" - android:layout_gravity="center" - android:layout_weight="0" - android:layout_marginStart="8dp" - android:scaleType="centerInside" - android:visibility="gone" - android:drawableAlpha="153" - /> - </LinearLayout> - </LinearLayout> -</FrameLayout> diff --git a/core/res/res/layout/notification_template_icon_group.xml b/core/res/res/layout/notification_template_icon_group.xml new file mode 100644 index 0000000..2ad6f9e --- /dev/null +++ b/core/res/res/layout/notification_template_icon_group.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2014 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 + --> + +<FrameLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:internal="http://schemas.android.com/apk/prv/res/android" + android:layout_width="@dimen/notification_large_icon_width" + android:layout_height="@dimen/notification_large_icon_height" + android:id="@+id/icon_group" + > + <ImageView android:id="@+id/icon" + android:layout_width="@dimen/notification_large_icon_width" + android:layout_height="@dimen/notification_large_icon_height" + android:padding="8dp" + android:scaleType="centerInside" + /> + <ImageView android:id="@+id/right_icon" + android:layout_width="24dp" + android:layout_height="24dp" + android:padding="4dp" + android:layout_gravity="end|bottom" + android:scaleType="centerInside" + android:visibility="gone" + android:layout_marginEnd="3dp" + android:layout_marginBottom="3dp" + /> +</FrameLayout> + diff --git a/core/res/res/layout/notification_template_inbox.xml b/core/res/res/layout/notification_template_inbox.xml deleted file mode 100644 index 1eec871..0000000 --- a/core/res/res/layout/notification_template_inbox.xml +++ /dev/null @@ -1,267 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- 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. ---> - -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:internal="http://schemas.android.com/apk/prv/res/android" - android:id="@+id/status_bar_latest_event_content" - android:background="@android:drawable/notification_bg" - android:layout_width="match_parent" - android:layout_height="wrap_content" - internal:layout_minHeight="65dp" - internal:layout_maxHeight="unbounded" - > - <ImageView android:id="@+id/icon" - android:layout_width="@dimen/notification_large_icon_width" - android:layout_height="@dimen/notification_large_icon_height" - android:background="@android:drawable/notification_template_icon_bg" - android:scaleType="center" - /> - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_gravity="fill_vertical" - android:layout_marginStart="@dimen/notification_large_icon_width" - android:minHeight="@dimen/notification_large_icon_height" - android:orientation="vertical" - android:paddingTop="0dp" - android:paddingBottom="2dp" - android:gravity="top" - > - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="@dimen/notification_large_icon_height" - android:paddingTop="2dp" - android:orientation="vertical" - > - <LinearLayout - android:id="@+id/line1" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginStart="8dp" - android:layout_marginEnd="8dp" - android:paddingTop="6dp" - android:orientation="horizontal" - android:layout_weight="0" - > - <TextView android:id="@+id/title" - android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Title" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:singleLine="true" - android:ellipsize="marquee" - android:fadingEdge="horizontal" - android:layout_weight="1" - /> - <ViewStub android:id="@+id/time" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_weight="0" - android:visibility="gone" - android:layout="@layout/notification_template_part_time" - /> - <ViewStub android:id="@+id/chronometer" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_weight="0" - android:visibility="gone" - android:layout="@layout/notification_template_part_chronometer" - /> - </LinearLayout> - <TextView android:id="@+id/text2" - android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Line2" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="-2dp" - android:layout_marginBottom="-2dp" - android:layout_marginStart="8dp" - android:layout_marginEnd="8dp" - android:singleLine="true" - android:fadingEdge="horizontal" - android:ellipsize="marquee" - android:visibility="gone" - android:layout_weight="0" - /> - <ProgressBar - android:id="@android:id/progress" - android:layout_width="match_parent" - android:layout_height="12dp" - android:layout_marginStart="8dp" - android:layout_marginEnd="8dp" - android:visibility="gone" - android:layout_weight="0" - style="?android:attr/progressBarStyleHorizontal" - /> - <TextView android:id="@+id/inbox_text0" - android:textAppearance="@style/TextAppearance.StatusBar.EventContent" - android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_marginStart="8dp" - android:layout_marginEnd="8dp" - android:singleLine="true" - android:ellipsize="end" - android:visibility="gone" - android:layout_weight="1" - /> - <TextView android:id="@+id/inbox_text1" - android:textAppearance="@style/TextAppearance.StatusBar.EventContent" - android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_marginStart="8dp" - android:layout_marginEnd="8dp" - android:singleLine="true" - android:ellipsize="end" - android:visibility="gone" - android:layout_weight="1" - /> - <TextView android:id="@+id/inbox_text2" - android:textAppearance="@style/TextAppearance.StatusBar.EventContent" - android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_marginStart="8dp" - android:layout_marginEnd="8dp" - android:singleLine="true" - android:ellipsize="end" - android:visibility="gone" - android:layout_weight="1" - /> - <TextView android:id="@+id/inbox_text3" - android:textAppearance="@style/TextAppearance.StatusBar.EventContent" - android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_marginStart="8dp" - android:layout_marginEnd="8dp" - android:singleLine="true" - android:ellipsize="end" - android:visibility="gone" - android:layout_weight="1" - /> - <TextView android:id="@+id/inbox_text4" - android:textAppearance="@style/TextAppearance.StatusBar.EventContent" - android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_marginStart="8dp" - android:singleLine="true" - android:ellipsize="end" - android:visibility="gone" - android:layout_weight="1" - /> - <TextView android:id="@+id/inbox_text5" - android:textAppearance="@style/TextAppearance.StatusBar.EventContent" - android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_marginStart="8dp" - android:layout_marginEnd="8dp" - android:singleLine="true" - android:ellipsize="end" - android:visibility="gone" - android:layout_weight="1" - /> - <TextView android:id="@+id/inbox_text6" - android:textAppearance="@style/TextAppearance.StatusBar.EventContent" - android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_marginStart="8dp" - android:layout_marginEnd="8dp" - android:singleLine="true" - android:ellipsize="end" - android:visibility="gone" - android:layout_weight="1" - /> - <TextView android:id="@+id/inbox_more" - android:textAppearance="@style/TextAppearance.StatusBar.EventContent" - android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_marginStart="8dp" - android:layout_marginEnd="8dp" - android:singleLine="true" - android:ellipsize="end" - android:visibility="gone" - android:layout_weight="1" - android:text="@android:string/ellipsis" - /> - <FrameLayout - android:id="@+id/inbox_end_pad" - android:layout_width="match_parent" - android:layout_height="8dip" - android:visibility="gone" - android:layout_weight="0" - /> - </LinearLayout> - <ImageView - android:layout_width="match_parent" - android:layout_height="1dip" - android:layout_marginTop="-1px" - android:id="@+id/action_divider" - android:background="?android:attr/dividerHorizontal" /> - <include - layout="@layout/notification_action_list" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_weight="0" - /> - <ImageView - android:layout_width="match_parent" - android:layout_height="1dip" - android:layout_marginTop="-1px" - android:id="@+id/overflow_divider" - android:visibility="visible" - android:background="?android:attr/dividerHorizontal" /> - <LinearLayout - android:id="@+id/line3" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="8dp" - android:layout_marginStart="8dp" - android:layout_marginBottom="8dp" - android:layout_marginEnd="8dp" - android:orientation="horizontal" - android:layout_weight="0" - android:gravity="center_vertical" - > - <TextView android:id="@+id/text" - android:textAppearance="@style/TextAppearance.StatusBar.EventContent" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="1" - android:layout_gravity="center" - android:singleLine="true" - android:ellipsize="marquee" - android:fadingEdge="horizontal" - /> - <TextView android:id="@+id/info" - android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Info" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:layout_weight="0" - android:singleLine="true" - android:gravity="center" - android:paddingStart="8dp" - /> - <ImageView android:id="@+id/right_icon" - android:layout_width="16dp" - android:layout_height="16dp" - android:layout_gravity="center" - android:layout_weight="0" - android:layout_marginStart="8dp" - android:scaleType="centerInside" - android:visibility="gone" - android:drawableAlpha="153" - /> - </LinearLayout> - </LinearLayout> -</FrameLayout> diff --git a/core/res/res/layout/notification_template_quantum_base.xml b/core/res/res/layout/notification_template_quantum_base.xml index 8f3019d..789bf32 100644 --- a/core/res/res/layout/notification_template_quantum_base.xml +++ b/core/res/res/layout/notification_template_quantum_base.xml @@ -23,10 +23,9 @@ internal:layout_minHeight="64dp" internal:layout_maxHeight="64dp" > - <ImageView android:id="@+id/icon" + <include layout="@layout/notification_template_icon_group" android:layout_width="@dimen/notification_large_icon_width" android:layout_height="@dimen/notification_large_icon_height" - android:scaleType="center" /> <LinearLayout android:layout_width="match_parent" @@ -91,7 +90,7 @@ android:layout_height="12dp" android:layout_marginStart="8dp" android:visibility="gone" - style="@style/Widget.Quantum.Light.ProgressBar.Horizontal" + style="@style/Widget.StatusBar.Quantum.ProgressBar" /> <LinearLayout android:id="@+id/line3" @@ -121,16 +120,6 @@ android:gravity="center" android:paddingStart="8dp" /> - <ImageView android:id="@+id/right_icon" - android:layout_width="16dp" - android:layout_height="16dp" - android:layout_gravity="center" - android:layout_weight="0" - android:layout_marginStart="8dp" - android:scaleType="centerInside" - android:visibility="gone" - android:drawableAlpha="153" - /> </LinearLayout> </LinearLayout> </FrameLayout> diff --git a/core/res/res/layout/notification_template_quantum_big_base.xml b/core/res/res/layout/notification_template_quantum_big_base.xml index 45e69b1..8cb5549 100644 --- a/core/res/res/layout/notification_template_quantum_big_base.xml +++ b/core/res/res/layout/notification_template_quantum_big_base.xml @@ -23,10 +23,9 @@ internal:layout_minHeight="65dp" internal:layout_maxHeight="unbounded" > - <ImageView android:id="@+id/icon" + <include layout="@layout/notification_template_icon_group" android:layout_width="@dimen/notification_large_icon_width" android:layout_height="@dimen/notification_large_icon_height" - android:scaleType="center" /> <LinearLayout android:layout_width="match_parent" @@ -128,16 +127,6 @@ android:gravity="center" android:paddingStart="8dp" /> - <ImageView android:id="@+id/right_icon" - android:layout_width="16dp" - android:layout_height="16dp" - android:layout_gravity="center" - android:layout_weight="0" - android:layout_marginStart="8dp" - android:scaleType="centerInside" - android:visibility="gone" - android:drawableAlpha="153" - /> </LinearLayout> <ProgressBar android:id="@android:id/progress" diff --git a/core/res/res/layout/notification_template_quantum_big_text.xml b/core/res/res/layout/notification_template_quantum_big_text.xml index f7769d7..bbd1071 100644 --- a/core/res/res/layout/notification_template_quantum_big_text.xml +++ b/core/res/res/layout/notification_template_quantum_big_text.xml @@ -22,10 +22,9 @@ internal:layout_minHeight="65dp" internal:layout_maxHeight="unbounded" > - <ImageView android:id="@+id/icon" + <include layout="@layout/notification_template_icon_group" android:layout_width="@dimen/notification_large_icon_width" android:layout_height="@dimen/notification_large_icon_height" - android:scaleType="center" /> <LinearLayout android:layout_width="match_parent" @@ -166,16 +165,6 @@ android:gravity="center" android:paddingStart="8dp" /> - <ImageView android:id="@+id/right_icon" - android:layout_width="16dp" - android:layout_height="16dp" - android:layout_gravity="center" - android:layout_weight="0" - android:layout_marginStart="8dp" - android:scaleType="centerInside" - android:visibility="gone" - android:drawableAlpha="153" - /> </LinearLayout> </LinearLayout> </FrameLayout> diff --git a/core/res/res/layout/notification_template_quantum_inbox.xml b/core/res/res/layout/notification_template_quantum_inbox.xml index 04974c4..a071d59 100644 --- a/core/res/res/layout/notification_template_quantum_inbox.xml +++ b/core/res/res/layout/notification_template_quantum_inbox.xml @@ -23,10 +23,9 @@ internal:layout_minHeight="65dp" internal:layout_maxHeight="unbounded" > - <ImageView android:id="@+id/icon" + <include layout="@layout/notification_template_icon_group" android:layout_width="@dimen/notification_large_icon_width" android:layout_height="@dimen/notification_large_icon_height" - android:scaleType="center" /> <LinearLayout android:layout_width="match_parent" @@ -250,16 +249,6 @@ android:gravity="center" android:paddingStart="8dp" /> - <ImageView android:id="@+id/right_icon" - android:layout_width="16dp" - android:layout_height="16dp" - android:layout_gravity="center" - android:layout_weight="0" - android:layout_marginStart="8dp" - android:scaleType="centerInside" - android:visibility="gone" - android:drawableAlpha="153" - /> </LinearLayout> </LinearLayout> </FrameLayout> diff --git a/core/res/res/layout/status_bar_latest_event_content.xml b/core/res/res/layout/status_bar_latest_event_content.xml index b3db01a..dc78174 100644 --- a/core/res/res/layout/status_bar_latest_event_content.xml +++ b/core/res/res/layout/status_bar_latest_event_content.xml @@ -22,7 +22,7 @@ android:layout_height="wrap_content" android:background="#FFFF00FF" > - <include layout="@layout/notification_template_base" + <include layout="@layout/notification_template_quantum_base" android:layout_width="match_parent" android:layout_height="wrap_content" /> diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml index 69b11cd..52b021f 100644 --- a/core/res/res/values/dimens.xml +++ b/core/res/res/values/dimens.xml @@ -227,9 +227,9 @@ <dimen name="action_bar_stacked_tab_max_width">180dp</dimen> <!-- Size of notification text (see TextAppearance.StatusBar.EventContent) --> - <dimen name="notification_text_size">14dp</dimen> + <dimen name="notification_text_size">13dp</dimen> <!-- Size of notification text titles (see TextAppearance.StatusBar.EventContent.Title) --> - <dimen name="notification_title_text_size">18dp</dimen> + <dimen name="notification_title_text_size">16dp</dimen> <!-- Size of smaller notification text (see TextAppearance.StatusBar.EventContent.Line2, Info, Time) --> <dimen name="notification_subtext_size">12dp</dimen> diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml index 891265f..fd57c5e 100644 --- a/core/res/res/values/styles.xml +++ b/core/res/res/values/styles.xml @@ -280,28 +280,28 @@ please see styles_device_defaults.xml. <style name="TextAppearance.StatusBar.Quantum"> </style> <style name="TextAppearance.StatusBar.Quantum.EventContent"> - <item name="android:textColor">#888888</item> + <item name="android:textColor">#90000000</item> <item name="android:textSize">@dimen/notification_text_size</item> </style> <style name="TextAppearance.StatusBar.Quantum.EventContent.Title"> - <item name="android:textColor">#000000</item> - <item name="android:fontFamily">sans-serif-light</item> + <item name="android:textColor">#DD000000</item> <item name="android:textSize">@dimen/notification_title_text_size</item> - <item name="android:textStyle">bold</item> </style> <style name="TextAppearance.StatusBar.Quantum.EventContent.Line2"> <item name="android:textSize">@dimen/notification_subtext_size</item> </style> <style name="TextAppearance.StatusBar.Quantum.EventContent.Info"> <item name="android:textSize">@dimen/notification_subtext_size</item> - <item name="android:textColor">#888888</item> </style> <style name="TextAppearance.StatusBar.Quantum.EventContent.Time"> <item name="android:textSize">@dimen/notification_subtext_size</item> - <item name="android:textColor">#888888</item> </style> <style name="TextAppearance.StatusBar.Quantum.EventContent.Emphasis"> - <item name="android:textColor">#555555</item> + <item name="android:textColor">#66000000</item> + </style> + + <style name="Widget.StatusBar.Quantum.ProgressBar" + parent="Widget.Quantum.Light.ProgressBar.Horizontal"> </style> <style name="TextAppearance.Small.CalendarViewWeekDayView"> diff --git a/core/res/res/values/styles_quantum.xml b/core/res/res/values/styles_quantum.xml index a49b89a..d04bddf 100644 --- a/core/res/res/values/styles_quantum.xml +++ b/core/res/res/values/styles_quantum.xml @@ -427,7 +427,10 @@ please see styles_device_defaults.xml. <item name="paddingEnd">8dp</item> </style> - <style name="Widget.Quantum.CheckedTextView" parent="Widget.CheckedTextView"/> + <style name="Widget.Quantum.CheckedTextView" parent="Widget.CheckedTextView"> + <item name="drawablePadding">4dip</item> + </style> + <style name="Widget.Quantum.TextSelectHandle" parent="Widget.TextSelectHandle"/> <style name="Widget.Quantum.TextSuggestionsPopupWindow" parent="Widget.TextSuggestionsPopupWindow"/> <style name="Widget.Quantum.AbsListView" parent="Widget.AbsListView"/> @@ -441,10 +444,12 @@ please see styles_device_defaults.xml. <style name="Widget.Quantum.CompoundButton.CheckBox" parent="Widget.CompoundButton.CheckBox"> <item name="background">?attr/selectableItemBackground</item> + <item name="drawablePadding">4dip</item> </style> <style name="Widget.Quantum.CompoundButton.RadioButton" parent="Widget.CompoundButton.RadioButton"> <item name="background">?attr/selectableItemBackground</item> + <item name="drawablePadding">4dip</item> </style> <style name="Widget.Quantum.CompoundButton.Star" parent="Widget.CompoundButton.Star"> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 84c9023..2f0ac49 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -1209,16 +1209,7 @@ <java-symbol type="layout" name="zoom_container" /> <java-symbol type="layout" name="zoom_controls" /> <java-symbol type="layout" name="zoom_magnify" /> - <java-symbol type="layout" name="notification_action" /> - <java-symbol type="layout" name="notification_action_tombstone" /> <java-symbol type="layout" name="notification_intruder_content" /> - <java-symbol type="layout" name="notification_template_base" /> - <java-symbol type="layout" name="notification_template_big_base" /> - <java-symbol type="layout" name="notification_template_big_picture" /> - <java-symbol type="layout" name="notification_template_big_text" /> - <java-symbol type="layout" name="notification_template_part_time" /> - <java-symbol type="layout" name="notification_template_part_chronometer" /> - <java-symbol type="layout" name="notification_template_inbox" /> <java-symbol type="layout" name="sms_short_code_confirmation_dialog" /> <java-symbol type="layout" name="action_bar_up_container" /> <java-symbol type="layout" name="app_not_authorized" /> @@ -1667,8 +1658,10 @@ <java-symbol type="layout" name="notification_template_quantum_big_picture" /> <java-symbol type="layout" name="notification_template_quantum_big_text" /> <java-symbol type="layout" name="notification_template_quantum_inbox" /> + <java-symbol type="layout" name="notification_template_icon_group" /> <java-symbol type="color" name="notification_action_legacy_color_filter" /> <java-symbol type="color" name="notification_icon_bg_color" /> + <java-symbol type="drawable" name="notification_icon_legacy_bg" /> <java-symbol type="drawable" name="notification_icon_legacy_bg_inset" /> <java-symbol type="drawable" name="notification_quantum_bg_dim" /> <java-symbol type="drawable" name="notification_quantum_bg" /> diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/integration/CameraBinderTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/integration/CameraBinderTest.java index 89886ef..8a7e642 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/integration/CameraBinderTest.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/integration/CameraBinderTest.java @@ -23,10 +23,10 @@ import android.hardware.ICameraServiceListener; import android.hardware.IProCameraCallbacks; import android.hardware.IProCameraUser; import android.hardware.camera2.CameraMetadata; -import android.hardware.camera2.CaptureResultExtras; import android.hardware.camera2.ICameraDeviceCallbacks; import android.hardware.camera2.ICameraDeviceUser; import android.hardware.camera2.impl.CameraMetadataNative; +import android.hardware.camera2.impl.CaptureResultExtras; import android.hardware.camera2.utils.BinderHolder; import android.hardware.camera2.utils.CameraBinderDecorator; import android.os.Binder; diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/integration/CameraDeviceBinderTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/integration/CameraDeviceBinderTest.java index 74ce997..7b2e7dd 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/integration/CameraDeviceBinderTest.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/integration/CameraDeviceBinderTest.java @@ -21,10 +21,10 @@ import android.graphics.SurfaceTexture; import android.hardware.camera2.CameraMetadata; import android.hardware.camera2.CameraCharacteristics; import android.hardware.camera2.CaptureRequest; -import android.hardware.camera2.CaptureResultExtras; import android.hardware.camera2.ICameraDeviceCallbacks; import android.hardware.camera2.ICameraDeviceUser; import android.hardware.camera2.impl.CameraMetadataNative; +import android.hardware.camera2.impl.CaptureResultExtras; import android.hardware.camera2.utils.BinderHolder; import android.media.Image; import android.media.ImageReader; diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/CameraMetadataTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/CameraMetadataTest.java index 5ab586f..a77b647 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/CameraMetadataTest.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/CameraMetadataTest.java @@ -18,6 +18,7 @@ package com.android.mediaframeworktest.unit; import android.test.suitebuilder.annotation.SmallTest; import android.util.Range; +import android.util.Rational; import android.util.SizeF; import android.graphics.ImageFormat; import android.graphics.Point; @@ -26,15 +27,14 @@ import android.graphics.Rect; import android.graphics.SurfaceTexture; import android.hardware.camera2.CameraCharacteristics; import android.hardware.camera2.CaptureResult; -import android.hardware.camera2.ColorSpaceTransform; -import android.hardware.camera2.Face; -import android.hardware.camera2.MeteringRectangle; -import android.hardware.camera2.Rational; -import android.hardware.camera2.RggbChannelVector; -import android.hardware.camera2.Size; +import android.util.Size; import android.hardware.camera2.impl.CameraMetadataNative; import android.hardware.camera2.marshal.impl.MarshalQueryableEnum; +import android.hardware.camera2.params.ColorSpaceTransform; +import android.hardware.camera2.params.Face; +import android.hardware.camera2.params.MeteringRectangle; import android.hardware.camera2.params.ReprocessFormatsMap; +import android.hardware.camera2.params.RggbChannelVector; import android.hardware.camera2.params.StreamConfiguration; import android.hardware.camera2.params.StreamConfigurationDuration; import android.hardware.camera2.params.StreamConfigurationMap; diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/RationalTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/RationalTest.java index 9621f92..18c0d3e 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/RationalTest.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/RationalTest.java @@ -17,7 +17,7 @@ package com.android.mediaframeworktest.unit; import android.test.suitebuilder.annotation.SmallTest; -import android.hardware.camera2.Rational; +import android.util.Rational; /** * <pre> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java index 91df9ef..5e8c769 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java @@ -21,6 +21,7 @@ import android.animation.AnimatorListenerAdapter; import android.animation.ObjectAnimator; import android.content.Context; import android.graphics.Canvas; +import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.view.MotionEvent; @@ -45,6 +46,9 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView private int mBgResId = R.drawable.notification_quantum_bg; private int mDimmedBgResId = R.drawable.notification_quantum_bg_dim; + private int mBgTint = 0; + private int mDimmedBgTint = 0; + /** * Flag to indicate that the notification has been touched once and the second touch will * click it. @@ -209,17 +213,23 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView * @param bgResId The background resource to use in normal state. * @param dimmedBgResId The background resource to use in dimmed state. */ - public void setBackgroundResourceIds(int bgResId, int dimmedBgResId) { + public void setBackgroundResourceIds(int bgResId, int bgTint, int dimmedBgResId, int dimmedTint) { mBgResId = bgResId; + mBgTint = bgTint; mDimmedBgResId = dimmedBgResId; + mDimmedBgTint = dimmedTint; updateBackgroundResource(); } + public void setBackgroundResourceIds(int bgResId, int dimmedBgResId) { + setBackgroundResourceIds(bgResId, 0, dimmedBgResId, 0); + } + private void fadeBackgroundResource() { if (mDimmed) { - setBackgroundDimmed(mDimmedBgResId); + setBackgroundDimmed(mDimmedBgResId, mDimmedBgTint); } else { - setBackgroundNormal(mBgResId); + setBackgroundNormal(mBgResId, mBgTint); } int startAlpha = mDimmed ? 255 : 0; int endAlpha = mDimmed ? 0 : 255; @@ -256,12 +266,12 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView private void updateBackgroundResource() { if (mDimmed) { - setBackgroundDimmed(mDimmedBgResId); + setBackgroundDimmed(mDimmedBgResId, mDimmedBgTint); mBackgroundDimmed.setAlpha(255); setBackgroundNormal(null); } else { setBackgroundDimmed(null); - setBackgroundNormal(mBgResId); + setBackgroundNormal(mBgResId, mBgTint); mBackgroundNormal.setAlpha(255); } } @@ -295,12 +305,20 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView invalidate(); } - private void setBackgroundNormal(int drawableResId) { - setBackgroundNormal(getResources().getDrawable(drawableResId)); + private void setBackgroundNormal(int drawableResId, int tintColor) { + final Drawable d = getResources().getDrawable(drawableResId); + if (tintColor != 0) { + d.setColorFilter(tintColor, PorterDuff.Mode.SRC_ATOP); + } + setBackgroundNormal(d); } - private void setBackgroundDimmed(int drawableResId) { - setBackgroundDimmed(getResources().getDrawable(drawableResId)); + private void setBackgroundDimmed(int drawableResId, int tintColor) { + final Drawable d = getResources().getDrawable(drawableResId); + if (tintColor != 0) { + d.setColorFilter(tintColor, PorterDuff.Mode.SRC_ATOP); + } + setBackgroundDimmed(d); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 898f06e..6090948 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -428,14 +428,16 @@ public abstract class BaseStatusBar extends SystemUI implements protected void applyLegacyRowBackground(StatusBarNotification sbn, NotificationData.Entry entry) { + int version = 0; + try { + ApplicationInfo info = mContext.getPackageManager().getApplicationInfo(sbn.getPackageName(), 0); + version = info.targetSdkVersion; + } catch (NameNotFoundException ex) { + Log.e(TAG, "Failed looking up ApplicationInfo for " + sbn.getPackageName(), ex); + } + if (entry.expanded.getId() != com.android.internal.R.id.status_bar_latest_event_content) { - int version = 0; - try { - ApplicationInfo info = mContext.getPackageManager().getApplicationInfo(sbn.getPackageName(), 0); - version = info.targetSdkVersion; - } catch (NameNotFoundException ex) { - Log.e(TAG, "Failed looking up ApplicationInfo for " + sbn.getPackageName(), ex); - } + // Using custom RemoteViews if (version > 0 && version < Build.VERSION_CODES.GINGERBREAD) { entry.row.setBackgroundResource(R.drawable.notification_row_legacy_bg); } else if (version < Build.VERSION_CODES.L) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java index 8c70517..dde2ebb 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java @@ -20,6 +20,7 @@ import android.animation.ObjectAnimator; import android.animation.TimeAnimator; import android.animation.TimeAnimator.TimeListener; import android.content.Context; +import android.content.res.Configuration; import android.content.res.Resources; import android.util.AttributeSet; import android.util.Log; @@ -218,7 +219,7 @@ public class PanelView extends FrameLayout { }; private float mVel, mAccel; - protected int mMaxPanelHeight = 0; + protected int mMaxPanelHeight = -1; private String mViewName; private float mInitialTouchY; private float mInitialTouchX; @@ -617,7 +618,8 @@ public class PanelView extends FrameLayout { // Did one of our children change size? int newHeight = getMeasuredHeight(); - if (newHeight != mMaxPanelHeight) { + if (newHeight > mMaxPanelHeight) { + // we only adapt the max height if it's bigger mMaxPanelHeight = newHeight; // If the user isn't actively poking us, let's rubberband to the content if (!mTracking && !mTimeAnimator.isStarted() @@ -695,6 +697,12 @@ public class PanelView extends FrameLayout { mExpandedFraction = Math.min(1f, (fh == 0) ? 0 : h / fh); } + @Override + protected void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + mMaxPanelHeight = -1; + } + protected void onHeightUpdated(float expandedHeight) { requestLayout(); } @@ -706,6 +714,7 @@ public class PanelView extends FrameLayout { * @return the default implementation simply returns the maximum height. */ protected int getMaxPanelHeight() { + mMaxPanelHeight = Math.max(mMaxPanelHeight, getHeight()); return mMaxPanelHeight; } diff --git a/services/core/java/com/android/server/AppOpsService.java b/services/core/java/com/android/server/AppOpsService.java index e26747c..be20616 100644 --- a/services/core/java/com/android/server/AppOpsService.java +++ b/services/core/java/com/android/server/AppOpsService.java @@ -36,12 +36,14 @@ import android.content.pm.PackageManager.NameNotFoundException; import android.media.AudioService; import android.os.AsyncTask; import android.os.Binder; +import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.Process; import android.os.RemoteException; import android.os.ServiceManager; import android.os.UserHandle; +import android.os.UserManager; import android.util.ArrayMap; import android.util.ArraySet; import android.util.AtomicFile; @@ -49,6 +51,7 @@ import android.util.Log; import android.util.Pair; import android.util.Slog; import android.util.SparseArray; +import android.util.SparseIntArray; import android.util.TimeUtils; import android.util.Xml; @@ -56,6 +59,7 @@ import com.android.internal.app.IAppOpsService; import com.android.internal.app.IAppOpsCallback; import com.android.internal.util.FastXmlSerializer; import com.android.internal.util.XmlUtils; +import com.google.android.util.AbstractMessageParser.MusicTrack; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; @@ -91,6 +95,10 @@ public class AppOpsService extends IAppOpsService.Stub { final SparseArray<HashMap<String, Ops>> mUidOps = new SparseArray<HashMap<String, Ops>>(); + private int mDeviceOwnerUid; + private final SparseIntArray mProfileOwnerUids = new SparseIntArray(); + private final SparseArray<boolean[]> mOpRestrictions = new SparseArray<boolean[]>(); + public final static class Ops extends SparseArray<Op> { public final String packageName; public final int uid; @@ -548,6 +556,9 @@ public class AppOpsService extends IAppOpsService.Stub { verifyIncomingUid(uid); verifyIncomingOp(code); synchronized (this) { + if (isOpRestricted(uid, code)) { + return AppOpsManager.MODE_IGNORED; + } Op op = getOpLocked(AppOpsManager.opToSwitch(code), uid, packageName, false); if (op == null) { return AppOpsManager.opToDefaultMode(code); @@ -631,6 +642,9 @@ public class AppOpsService extends IAppOpsService.Stub { return AppOpsManager.MODE_ERRORED; } Op op = getOpLocked(ops, code, true); + if (isOpRestricted(uid, code)) { + return AppOpsManager.MODE_IGNORED; + } if (op.duration == -1) { Slog.w(TAG, "Noting op not finished: uid " + uid + " pkg " + packageName + " code " + code + " time=" + op.time + " duration=" + op.duration); @@ -665,6 +679,9 @@ public class AppOpsService extends IAppOpsService.Stub { return AppOpsManager.MODE_ERRORED; } Op op = getOpLocked(ops, code, true); + if (isOpRestricted(uid, code)) { + return AppOpsManager.MODE_IGNORED; + } final int switchCode = AppOpsManager.opToSwitch(code); final Op switchOp = switchCode != code ? getOpLocked(ops, switchCode, true) : op; if (switchOp.mode != AppOpsManager.MODE_ALLOWED) { @@ -830,6 +847,23 @@ public class AppOpsService extends IAppOpsService.Stub { return op; } + private boolean isOpRestricted(int uid, int code) { + int userHandle = UserHandle.getUserId(uid); + boolean[] opRestrictions = mOpRestrictions.get(userHandle); + if ((opRestrictions != null) && opRestrictions[code]) { + if (userHandle == UserHandle.USER_OWNER) { + if (uid != mDeviceOwnerUid) { + return true; + } + } else { + if (uid != mProfileOwnerUids.get(userHandle, -1)) { + return true; + } + } + } + return false; + } + void readState() { synchronized (mFile) { synchronized (this) { @@ -1167,4 +1201,66 @@ public class AppOpsService extends IAppOpsService.Stub { int mode; ArraySet<String> exceptionPackages = NO_EXCEPTIONS; } + + @Override + public void setDeviceOwner(String packageName) throws RemoteException { + checkSystemUid("setDeviceOwner"); + try { + mDeviceOwnerUid = mContext.getPackageManager().getPackageUid(packageName, + UserHandle.USER_OWNER); + } catch (NameNotFoundException e) { + Log.e(TAG, "Could not find Device Owner UID"); + mDeviceOwnerUid = -1; + throw new IllegalArgumentException("Could not find device owner package " + + packageName); + } + } + + @Override + public void setProfileOwner(String packageName, int userHandle) throws RemoteException { + checkSystemUid("setProfileOwner"); + try { + int uid = mContext.getPackageManager().getPackageUid(packageName, + userHandle); + mProfileOwnerUids.put(userHandle, uid); + } catch (NameNotFoundException e) { + Log.e(TAG, "Could not find Profile Owner UID"); + mProfileOwnerUids.put(userHandle, -1); + throw new IllegalArgumentException("Could not find profile owner package " + + packageName); + } + } + + @Override + public void setUserRestrictions(Bundle restrictions, int userHandle) throws RemoteException { + checkSystemUid("setUserRestrictions"); + boolean[] opRestrictions = mOpRestrictions.get(userHandle); + if (opRestrictions == null) { + opRestrictions = new boolean[AppOpsManager._NUM_OP]; + mOpRestrictions.put(userHandle, opRestrictions); + } + for (int i = 0; i < opRestrictions.length; ++i) { + String restriction = AppOpsManager.opToRestriction(i); + if (restriction != null) { + opRestrictions[i] = restrictions.getBoolean(restriction, false); + } else { + opRestrictions[i] = false; + } + } + } + + @Override + public void removeUser(int userHandle) throws RemoteException { + checkSystemUid("removeUser"); + mOpRestrictions.remove(userHandle); + mProfileOwnerUids.removeAt(mProfileOwnerUids.indexOfKey(userHandle)); + } + + private void checkSystemUid(String function) { + int uid = Binder.getCallingUid(); + if (uid != Process.SYSTEM_UID) { + throw new SecurityException(function + " must by called by the system"); + } + } + } diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java index 982dce0..2d0f6d1 100644 --- a/services/core/java/com/android/server/ConnectivityService.java +++ b/services/core/java/com/android/server/ConnectivityService.java @@ -3216,6 +3216,7 @@ public class ConnectivityService extends IConnectivityManager.Stub { // tell the network currently servicing this that it's no longer interested NetworkAgentInfo affectedNetwork = mNetworkForRequestId.get(nri.request.requestId); if (affectedNetwork != null) { + mNetworkForRequestId.remove(nri.request.requestId); affectedNetwork.networkRequests.remove(nri.request.requestId); if (VDBG) { log(" Removing from current network " + affectedNetwork.name() + ", leaving " + diff --git a/services/core/java/com/android/server/am/BatteryStatsService.java b/services/core/java/com/android/server/am/BatteryStatsService.java index 908bfbd..249422b 100644 --- a/services/core/java/com/android/server/am/BatteryStatsService.java +++ b/services/core/java/com/android/server/am/BatteryStatsService.java @@ -623,8 +623,8 @@ public final class BatteryStatsService extends IBatteryStats.Stub pw.println(" --charged: only output data since last charged."); pw.println(" --reset: reset the stats, clearing all current data."); pw.println(" --write: force write current collected stats to disk."); - pw.println(" --enable: enable an option: full-wake-history."); - pw.println(" --disable: disable an option: full-wake-history."); + pw.println(" --enable: enable an option: full-wake-history, no-auto-reset."); + pw.println(" --disable: disable an option: full-wake-history, no-auto-reset."); pw.println(" -h: print this help text."); pw.println(" <package.name>: optional name of package to filter output by."); } @@ -640,6 +640,10 @@ public final class BatteryStatsService extends IBatteryStats.Stub synchronized (mStats) { mStats.setRecordAllWakeLocksLocked(enable); } + } else if ("no-auto-reset".equals(args[i])) { + synchronized (mStats) { + mStats.setNoAutoReset(enable); + } } else { pw.println("Unknown enable/disable option: " + args[i]); dumpHelp(pw); diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java index 60212bf..131d05b 100644 --- a/services/core/java/com/android/server/pm/UserManagerService.java +++ b/services/core/java/com/android/server/pm/UserManagerService.java @@ -40,6 +40,7 @@ import android.os.Handler; import android.os.IUserManager; import android.os.Process; import android.os.RemoteException; +import android.os.ServiceManager; import android.os.UserHandle; import android.os.UserManager; import android.util.AtomicFile; @@ -50,6 +51,7 @@ import android.util.SparseBooleanArray; import android.util.TimeUtils; import android.util.Xml; +import com.android.internal.app.IAppOpsService; import com.android.internal.content.PackageMonitor; import com.android.internal.util.ArrayUtils; import com.android.internal.util.FastXmlSerializer; @@ -162,6 +164,8 @@ public class UserManagerService extends IUserManager.Stub { private int mNextSerialNumber; private int mUserVersion = 0; + private IAppOpsService mAppOpsService; + private static UserManagerService sInstance; public static UserManagerService getInstance() { @@ -236,6 +240,15 @@ public class UserManagerService extends IUserManager.Stub { void systemReady() { mUserPackageMonitor.register(mContext, null, UserHandle.ALL, false); userForeground(UserHandle.USER_OWNER); + mAppOpsService = IAppOpsService.Stub.asInterface( + ServiceManager.getService(Context.APP_OPS_SERVICE)); + for (int i = 0; i < mUserIds.length; ++i) { + try { + mAppOpsService.setUserRestrictions(mUserRestrictions.get(mUserIds[i]), mUserIds[i]); + } catch (RemoteException e) { + Log.w(LOG_TAG, "Unable to notify AppOpsService of UserRestrictions"); + } + } } @Override @@ -482,6 +495,14 @@ public class UserManagerService extends IUserManager.Stub { synchronized (mPackagesLock) { mUserRestrictions.get(userId).clear(); mUserRestrictions.get(userId).putAll(restrictions); + long token = Binder.clearCallingIdentity(); + try { + mAppOpsService.setUserRestrictions(mUserRestrictions.get(userId), userId); + } catch (RemoteException e) { + Log.w(LOG_TAG, "Unable to notify AppOpsService of UserRestrictions"); + } finally { + Binder.restoreCallingIdentity(token); + } writeUserLocked(mUsers.get(userId)); } } @@ -1116,6 +1137,11 @@ public class UserManagerService extends IUserManager.Stub { return false; } mRemovingUserIds.put(userHandle, true); + try { + mAppOpsService.removeUser(userHandle); + } catch (RemoteException e) { + Log.w(LOG_TAG, "Unable to notify AppOpsService of removing user", e); + } // Set this to a partially created user, so that the user will be purged // on next startup, in case the runtime stops now before stopping and // removing the user completely. @@ -1125,6 +1151,14 @@ public class UserManagerService extends IUserManager.Stub { user.flags |= UserInfo.FLAG_DISABLED; writeUserLocked(user); } + + if (user.profileGroupId != UserInfo.NO_PROFILE_GROUP_ID + && user.isManagedProfile()) { + // Send broadcast to notify system that the user removed was a + // managed user. + sendProfileRemovedBroadcast(user.profileGroupId, user.id); + } + if (DBG) Slog.i(LOG_TAG, "Stopping user " + userHandle); int res; try { @@ -1151,7 +1185,6 @@ public class UserManagerService extends IUserManager.Stub { // wiping the user's system directory and removing from the user list long ident = Binder.clearCallingIdentity(); try { - final boolean isManaged = getUserInfo(userHandle).isManagedProfile(); Intent addedIntent = new Intent(Intent.ACTION_USER_REMOVED); addedIntent.putExtra(Intent.EXTRA_USER_HANDLE, userHandle); mContext.sendOrderedBroadcastAsUser(addedIntent, UserHandle.ALL, @@ -1172,11 +1205,6 @@ public class UserManagerService extends IUserManager.Stub { removeUserStateLocked(userHandle); } } - // Send broadcast to notify system that the user removed was a - // managed user. - if (isManaged) { - sendProfileRemovedBroadcast(userHandle); - } } }.start(); } @@ -1228,11 +1256,11 @@ public class UserManagerService extends IUserManager.Stub { parent.delete(); } - private void sendProfileRemovedBroadcast(int userHandle) { + private void sendProfileRemovedBroadcast(int parentUserId, int removedUserId) { Intent managedProfileIntent = new Intent(Intent.ACTION_MANAGED_PROFILE_REMOVED); - managedProfileIntent.putExtra(Intent.EXTRA_USER, new UserHandle(userHandle)); - // Note: This makes an assumption that the parent owner is user 0. - mContext.sendBroadcastAsUser(managedProfileIntent, UserHandle.OWNER, null); + managedProfileIntent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND); + managedProfileIntent.putExtra(Intent.EXTRA_USER, new UserHandle(removedUserId)); + mContext.sendBroadcastAsUser(managedProfileIntent, new UserHandle(parentUserId), null); } @Override diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DeviceOwner.java b/services/devicepolicy/java/com/android/server/devicepolicy/DeviceOwner.java index 1647425..674c6f4 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DeviceOwner.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DeviceOwner.java @@ -39,6 +39,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.HashMap; +import java.util.Set; /** * Stores and restores state for the Device and Profile owners. By definition there can be @@ -137,6 +138,10 @@ public class DeviceOwner { return profileOwner != null ? profileOwner.name : null; } + Set<Integer> getProfileOwnerKeys() { + return mProfileOwners.keySet(); + } + boolean hasDeviceOwner() { return mDeviceOwner != null; } diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index 1980d1e..edbbc9f 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -19,6 +19,7 @@ package com.android.server.devicepolicy; import static android.Manifest.permission.MANAGE_CA_CERTIFICATES; import com.android.internal.R; +import com.android.internal.app.IAppOpsService; import com.android.internal.os.storage.ExternalStorageFormatter; import com.android.internal.util.FastXmlSerializer; import com.android.internal.util.JournaledFile; @@ -237,6 +238,8 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } }; + private IAppOpsService mAppOpsService; + static class ActiveAdmin { private static final String TAG_DISABLE_KEYGUARD_FEATURES = "disable-keyguard-features"; private static final String TAG_DISABLE_CAMERA = "disable-camera"; @@ -1209,6 +1212,24 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { loadSettingsLocked(getUserData(UserHandle.USER_OWNER), UserHandle.USER_OWNER); loadDeviceOwner(); } + mAppOpsService = IAppOpsService.Stub.asInterface( + ServiceManager.getService(Context.APP_OPS_SERVICE)); + if (mDeviceOwner != null) { + if (mDeviceOwner.hasDeviceOwner()) { + try { + mAppOpsService.setDeviceOwner(mDeviceOwner.getDeviceOwnerPackageName()); + } catch (RemoteException e) { + Log.w(LOG_TAG, "Unable to notify AppOpsService of DeviceOwner", e); + } + } + for (Integer i : mDeviceOwner.getProfileOwnerKeys()) { + try { + mAppOpsService.setProfileOwner(mDeviceOwner.getProfileOwnerName(i), i); + } catch (RemoteException e) { + Log.w(LOG_TAG, "Unable to notify AppOpsService of ProfileOwner", e); + } + } + } } private void handlePasswordExpirationNotification(int userHandle) { @@ -2953,6 +2974,14 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { "Trying to set device owner but device owner is already set."); } + long token = Binder.clearCallingIdentity(); + try { + mAppOpsService.setDeviceOwner(packageName); + } catch (RemoteException e) { + Log.w(LOG_TAG, "Unable to notify AppOpsService of DeviceOwner", e); + } finally { + Binder.restoreCallingIdentity(token); + } if (mDeviceOwner == null) { // Device owner is not set and does not exist, set it. mDeviceOwner = DeviceOwner.createWithDeviceOwner(packageName, ownerName); @@ -3029,6 +3058,14 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { throw new IllegalStateException( "Trying to set profile owner but user is already set-up."); } + long token = Binder.clearCallingIdentity(); + try { + mAppOpsService.setProfileOwner(packageName, userHandle); + } catch (RemoteException e) { + Log.w(LOG_TAG, "Unable to notify AppOpsService of ProfileOwner", e); + } finally { + Binder.restoreCallingIdentity(token); + } if (mDeviceOwner == null) { // Device owner state does not exist, create it. mDeviceOwner = DeviceOwner.createWithProfileOwner(packageName, ownerName, diff --git a/test-runner/src/android/test/mock/MockContext.java b/test-runner/src/android/test/mock/MockContext.java index 0d9cd18..c162bf2 100644 --- a/test-runner/src/android/test/mock/MockContext.java +++ b/test-runner/src/android/test/mock/MockContext.java @@ -350,7 +350,17 @@ public class MockContext extends Context { throw new UnsupportedOperationException(); } + /** @hide */ + @Override + public void sendOrderedBroadcastAsUser(Intent intent, UserHandle user, + String receiverPermission, int appOp, BroadcastReceiver resultReceiver, + Handler scheduler, + int initialCode, String initialData, Bundle initialExtras) { + throw new UnsupportedOperationException(); + } + @Override + public void sendStickyBroadcast(Intent intent) { throw new UnsupportedOperationException(); } diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java index 08e9d99..d31239b 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java @@ -567,7 +567,7 @@ public final class BridgeContext extends Context { StyleResourceValue customStyleValues = null; if (customStyle != null) { ResourceValue item = mRenderResources.findResValue(customStyle, - false /*forceFrameworkOnly*/); + isPlatformFile /*forceFrameworkOnly*/); // resolve it in case it links to something else item = mRenderResources.resolveResValue(item); @@ -1284,6 +1284,14 @@ public final class BridgeContext extends Context { } @Override + public void sendOrderedBroadcastAsUser(Intent intent, UserHandle user, + String receiverPermission, int appOp, BroadcastReceiver resultReceiver, + Handler scheduler, + int initialCode, String initialData, Bundle initialExtras) { + // pass + } + + @Override public void sendStickyBroadcast(Intent arg0) { // pass |
