diff options
28 files changed, 228 insertions, 314 deletions
diff --git a/api/current.txt b/api/current.txt index 6dbc861..2eea8ac 100644 --- a/api/current.txt +++ b/api/current.txt @@ -19978,6 +19978,7 @@ package android.os { public class UserManager { method public android.os.Bundle getApplicationRestrictions(java.lang.String); + method public android.graphics.drawable.Drawable getBadgedDrawableForUser(android.graphics.drawable.Drawable, android.os.UserHandle); method public long getSerialNumberForUser(android.os.UserHandle); method public int getUserCount(); method public android.os.UserHandle getUserForSerialNumber(long); diff --git a/cmds/app_process/app_main.cpp b/cmds/app_process/app_main.cpp index c520b58..859d83b 100644 --- a/cmds/app_process/app_main.cpp +++ b/cmds/app_process/app_main.cpp @@ -97,7 +97,7 @@ public: virtual void onExit(int code) { - if (mClassName == NULL) { + if (mClassName.isEmpty()) { // if zygote IPCThreadState::self()->stopProcess(); } diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java index 728c560..8aef9bd 100644 --- a/core/java/android/os/UserManager.java +++ b/core/java/android/os/UserManager.java @@ -492,7 +492,20 @@ public class UserManager { return profiles; } - /** @hide */ + /** + * If the target user is a managed profile of the calling user or the caller + * is itself a managed profile, then this returns a badged copy of the given + * icon to be able to distinguish it from the original icon. + * <P> + * If the original drawable is not a BitmapDrawable, then the original + * drawable is returned. + * </P> + * + * @param icon The icon to badge. + * @param user The target user. + * @return A drawable that combines the original icon and a badge as + * determined by the system. + */ public Drawable getBadgedDrawableForUser(Drawable icon, UserHandle user) { int badgeResId = getBadgeResIdForUser(user.getIdentifier()); if (badgeResId == 0) { diff --git a/core/java/android/provider/SearchIndexableData.java b/core/java/android/provider/SearchIndexableData.java index 3f88f18..60bcc40 100644 --- a/core/java/android/provider/SearchIndexableData.java +++ b/core/java/android/provider/SearchIndexableData.java @@ -115,6 +115,7 @@ public abstract class SearchIndexableData { * Default constructor. */ public SearchIndexableData() { + locale = Locale.getDefault(); enabled = true; } @@ -124,9 +125,8 @@ public abstract class SearchIndexableData { * @param ctx the Context */ public SearchIndexableData(Context ctx) { + this(); context = ctx; - locale = Locale.getDefault(); - enabled = true; } @Override diff --git a/core/java/android/provider/SearchIndexableResource.java b/core/java/android/provider/SearchIndexableResource.java index bf33c65..c807df2 100644 --- a/core/java/android/provider/SearchIndexableResource.java +++ b/core/java/android/provider/SearchIndexableResource.java @@ -48,6 +48,7 @@ public class SearchIndexableResource extends SearchIndexableData { * @param iconResId the resource ID associated with the data. */ public SearchIndexableResource(int rank, int xmlResId, String className, int iconResId) { + super(); this.rank = rank; this.xmlResId = xmlResId; this.className = className; diff --git a/core/java/android/provider/SearchIndexablesContract.java b/core/java/android/provider/SearchIndexablesContract.java index 1754dce..307ac39 100644 --- a/core/java/android/provider/SearchIndexablesContract.java +++ b/core/java/android/provider/SearchIndexablesContract.java @@ -165,7 +165,7 @@ public class SearchIndexablesContract { public static final String COLUMN_SUMMARY_OFF = "summaryOff"; /** - * Entries associated with the raw data (when the data can can several values). + * Entries associated with the raw data (when the data can have several values). */ public static final String COLUMN_ENTRIES = "entries"; @@ -175,7 +175,7 @@ public class SearchIndexablesContract { public static final String COLUMN_KEYWORDS = "keywords"; /** - * Fragment's title associated with the raw data. + * Fragment or Activity title associated with the raw data. */ public static final String COLUMN_SCREEN_TITLE = "screenTitle"; diff --git a/core/java/android/view/IWindow.aidl b/core/java/android/view/IWindow.aidl index 8ec07ef..3670eed 100644 --- a/core/java/android/view/IWindow.aidl +++ b/core/java/android/view/IWindow.aidl @@ -50,7 +50,6 @@ oneway interface IWindow { void moved(int newX, int newY); void dispatchAppVisibility(boolean visible); void dispatchGetNewSurface(); - void dispatchScreenState(boolean on); /** * Tell the window that it is either gaining or losing focus. Keep it up diff --git a/core/java/android/view/ThreadedRenderer.java b/core/java/android/view/ThreadedRenderer.java index 789b761..cbb98e1 100644 --- a/core/java/android/view/ThreadedRenderer.java +++ b/core/java/android/view/ThreadedRenderer.java @@ -55,9 +55,12 @@ public class ThreadedRenderer extends HardwareRenderer { private int mWidth, mHeight; private long mNativeProxy; private boolean mInitialized = false; + private RenderNode mRootNode; ThreadedRenderer(boolean translucent) { mNativeProxy = nCreateProxy(translucent); + mRootNode = RenderNode.create("RootNode"); + mRootNode.setClipToBounds(false); } @Override @@ -127,6 +130,7 @@ public class ThreadedRenderer extends HardwareRenderer { void setup(int width, int height) { mWidth = width; mHeight = height; + mRootNode.setLeftTopRightBottom(0, 0, mWidth, mHeight); nSetup(mNativeProxy, width, height); } @@ -165,10 +169,7 @@ public class ThreadedRenderer extends HardwareRenderer { public void repeatLastDraw() { } - @Override - void draw(View view, AttachInfo attachInfo, HardwareDrawCallbacks callbacks, Rect dirty) { - attachInfo.mIgnoreDirtyState = true; - attachInfo.mDrawingTime = SystemClock.uptimeMillis(); + private void updateRootDisplayList(View view, HardwareDrawCallbacks callbacks) { view.mPrivateFlags |= View.PFLAG_DRAWN; view.mRecreateDisplayList = (view.mPrivateFlags & View.PFLAG_INVALIDATED) @@ -176,15 +177,27 @@ public class ThreadedRenderer extends HardwareRenderer { view.mPrivateFlags &= ~View.PFLAG_INVALIDATED; Trace.traceBegin(Trace.TRACE_TAG_VIEW, "getDisplayList"); - RenderNode displayList = view.getDisplayList(); + HardwareCanvas canvas = mRootNode.start(mWidth, mHeight); + callbacks.onHardwarePostDraw(canvas); + canvas.drawDisplayList(view.getDisplayList()); + callbacks.onHardwarePostDraw(canvas); + mRootNode.end(canvas); Trace.traceEnd(Trace.TRACE_TAG_VIEW); view.mRecreateDisplayList = false; + } + + @Override + void draw(View view, AttachInfo attachInfo, HardwareDrawCallbacks callbacks, Rect dirty) { + attachInfo.mIgnoreDirtyState = true; + attachInfo.mDrawingTime = SystemClock.uptimeMillis(); + + updateRootDisplayList(view, callbacks); if (dirty == null) { dirty = NULL_RECT; } - nDrawDisplayList(mNativeProxy, displayList.getNativeDisplayList(), + nDrawDisplayList(mNativeProxy, mRootNode.getNativeDisplayList(), dirty.left, dirty.top, dirty.right, dirty.bottom); } diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 3c0e6ef..f44cc87 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -17128,8 +17128,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, // If the screen is off assume the animation start time is now instead of // the next frame we draw. Keeping the START_ON_FIRST_FRAME start time // would cause the animation to start when the screen turns back on - if (mAttachInfo != null && !mAttachInfo.mScreenOn && - animation.getStartTime() == Animation.START_ON_FIRST_FRAME) { + if (mAttachInfo != null && mAttachInfo.mDisplayState == Display.STATE_OFF + && animation.getStartTime() == Animation.START_ON_FIRST_FRAME) { animation.setStartTime(AnimationUtils.currentAnimationTimeMillis()); } animation.reset(); @@ -19108,7 +19108,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * A set of information given to a view when it is attached to its parent * window. */ - static class AttachInfo { + final static class AttachInfo { interface Callbacks { void playSoundEffect(int effectId); boolean performHapticFeedback(int effectId, boolean always); @@ -19171,7 +19171,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback, boolean mHardwareAccelerationRequested; HardwareRenderer mHardwareRenderer; - boolean mScreenOn; + /** + * The state of the display to which the window is attached, as reported + * by {@link Display#getState()}. Note that the display state constants + * declared by {@link Display} do not exactly line up with the screen state + * constants declared by {@link View} (there are more display states than + * screen states). + */ + int mDisplayState = Display.STATE_UNKNOWN; /** * Scale factor used by the compatibility mode diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 65ac50d..ef22def 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -37,6 +37,8 @@ import android.graphics.PorterDuff; import android.graphics.Rect; import android.graphics.Region; import android.graphics.drawable.Drawable; +import android.hardware.display.DisplayManager; +import android.hardware.display.DisplayManager.DisplayListener; import android.media.AudioManager; import android.os.Binder; import android.os.Bundle; @@ -134,6 +136,7 @@ public final class ViewRootImpl implements ViewParent, final Context mContext; final IWindowSession mWindowSession; final Display mDisplay; + final DisplayManager mDisplayManager; final String mBasePackageName; final int[] mTmpLocation = new int[2]; @@ -370,9 +373,7 @@ public final class ViewRootImpl implements ViewParent, mNoncompatDensity = context.getResources().getDisplayMetrics().noncompatDensityDpi; mFallbackEventHandler = PolicyManager.makeNewFallbackEventHandler(context); mChoreographer = Choreographer.getInstance(); - - PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE); - mAttachInfo.mScreenOn = powerManager.isScreenOn(); + mDisplayManager = (DisplayManager)context.getSystemService(Context.DISPLAY_SERVICE); loadSystemProperties(); } @@ -427,6 +428,10 @@ public final class ViewRootImpl implements ViewParent, synchronized (this) { if (mView == null) { mView = view; + + mAttachInfo.mDisplayState = mDisplay.getState(); + mDisplayManager.registerDisplayListener(mDisplayListener, mHandler); + mViewLayoutDirectionInitial = mView.getRawLayoutDirection(); mFallbackEventHandler.setView(view); mWindowAttributes.copyFrom(attrs); @@ -797,18 +802,43 @@ public final class ViewRootImpl implements ViewParent, scheduleTraversals(); } - void handleScreenStateChange(boolean on) { - if (on != mAttachInfo.mScreenOn) { - mAttachInfo.mScreenOn = on; - if (mView != null) { - mView.dispatchScreenStateChanged(on ? View.SCREEN_STATE_ON : View.SCREEN_STATE_OFF); - } - if (on) { - mFullRedrawNeeded = true; - scheduleTraversals(); + private final DisplayListener mDisplayListener = new DisplayListener() { + @Override + public void onDisplayChanged(int displayId) { + if (mView != null && mDisplay.getDisplayId() == displayId) { + final int oldDisplayState = mAttachInfo.mDisplayState; + final int newDisplayState = mDisplay.getState(); + if (oldDisplayState != newDisplayState) { + mAttachInfo.mDisplayState = newDisplayState; + if (oldDisplayState != Display.STATE_UNKNOWN) { + final int oldScreenState = toViewScreenState(oldDisplayState); + final int newScreenState = toViewScreenState(newDisplayState); + if (oldScreenState != newScreenState) { + mView.dispatchScreenStateChanged(newScreenState); + } + if (oldDisplayState == Display.STATE_OFF) { + // Draw was suppressed so we need to for it to happen here. + mFullRedrawNeeded = true; + scheduleTraversals(); + } + } + } } } - } + + @Override + public void onDisplayRemoved(int displayId) { + } + + @Override + public void onDisplayAdded(int displayId) { + } + + private int toViewScreenState(int displayState) { + return displayState == Display.STATE_OFF ? + View.SCREEN_STATE_OFF : View.SCREEN_STATE_ON; + } + }; @Override public void requestFitSystemWindows() { @@ -2174,10 +2204,7 @@ public final class ViewRootImpl implements ViewParent, mResizePaint.setAlpha(mResizeAlpha); canvas.drawHardwareLayer(mResizeBuffer, 0.0f, mHardwareYOffset, mResizePaint); } - // TODO: this - if (!HardwareRenderer.sUseRenderThread) { - drawAccessibilityFocusedDrawableIfNeeded(canvas); - } + drawAccessibilityFocusedDrawableIfNeeded(canvas); } /** @@ -2247,7 +2274,7 @@ public final class ViewRootImpl implements ViewParent, } private void performDraw() { - if (!mAttachInfo.mScreenOn && !mReportNextDraw) { + if (mAttachInfo.mDisplayState == Display.STATE_OFF && !mReportNextDraw) { return; } @@ -2873,6 +2900,8 @@ public final class ViewRootImpl implements ViewParent, mInputChannel = null; } + mDisplayManager.unregisterDisplayListener(mDisplayListener); + unscheduleTraversals(); } @@ -2952,7 +2981,6 @@ public final class ViewRootImpl implements ViewParent, private final static int MSG_DISPATCH_SYSTEM_UI_VISIBILITY = 17; private final static int MSG_UPDATE_CONFIGURATION = 18; private final static int MSG_PROCESS_INPUT_EVENTS = 19; - private final static int MSG_DISPATCH_SCREEN_STATE = 20; private final static int MSG_CLEAR_ACCESSIBILITY_FOCUS_HOST = 21; private final static int MSG_DISPATCH_DONE_ANIMATING = 22; private final static int MSG_INVALIDATE_WORLD = 23; @@ -2999,8 +3027,6 @@ public final class ViewRootImpl implements ViewParent, return "MSG_UPDATE_CONFIGURATION"; case MSG_PROCESS_INPUT_EVENTS: return "MSG_PROCESS_INPUT_EVENTS"; - case MSG_DISPATCH_SCREEN_STATE: - return "MSG_DISPATCH_SCREEN_STATE"; case MSG_CLEAR_ACCESSIBILITY_FOCUS_HOST: return "MSG_CLEAR_ACCESSIBILITY_FOCUS_HOST"; case MSG_DISPATCH_DONE_ANIMATING: @@ -3214,11 +3240,6 @@ public final class ViewRootImpl implements ViewParent, } updateConfiguration(config, false); } break; - case MSG_DISPATCH_SCREEN_STATE: { - if (mView != null) { - handleScreenStateChange(msg.arg1 == 1); - } - } break; case MSG_CLEAR_ACCESSIBILITY_FOCUS_HOST: { setAccessibilityFocus(null, null); } break; @@ -5795,12 +5816,6 @@ public final class ViewRootImpl implements ViewParent, mHandler.sendMessage(msg); } - public void dispatchScreenStateChange(boolean on) { - Message msg = mHandler.obtainMessage(MSG_DISPATCH_SCREEN_STATE); - msg.arg1 = on ? 1 : 0; - mHandler.sendMessage(msg); - } - public void dispatchGetNewSurface() { Message msg = mHandler.obtainMessage(MSG_DISPATCH_GET_NEW_SURFACE); mHandler.sendMessage(msg); @@ -6139,14 +6154,6 @@ public final class ViewRootImpl implements ViewParent, } @Override - public void dispatchScreenState(boolean on) { - final ViewRootImpl viewAncestor = mViewAncestor.get(); - if (viewAncestor != null) { - viewAncestor.dispatchScreenStateChange(on); - } - } - - @Override public void dispatchGetNewSurface() { final ViewRootImpl viewAncestor = mViewAncestor.get(); if (viewAncestor != null) { diff --git a/core/java/android/view/VolumePanel.java b/core/java/android/view/VolumePanel.java index 8eae629..4730e59 100644 --- a/core/java/android/view/VolumePanel.java +++ b/core/java/android/view/VolumePanel.java @@ -27,8 +27,6 @@ import android.content.DialogInterface; import android.content.Intent; import android.content.IntentFilter; import android.content.res.Resources; -import android.content.res.TypedArray; -import android.graphics.drawable.Drawable; import android.media.AudioManager; import android.media.AudioService; import android.media.AudioSystem; @@ -58,10 +56,8 @@ import java.util.HashMap; * * @hide */ -public class VolumePanel extends Handler implements OnSeekBarChangeListener, View.OnClickListener, - VolumeController -{ - private static final String TAG = "VolumePanel"; +public class VolumePanel extends Handler implements VolumeController { + private static final String TAG = VolumePanel.class.getSimpleName(); private static boolean LOGD = false; /** @@ -189,7 +185,7 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie this.iconMuteRes = iconMuteRes; this.show = show; } - }; + } // List of stream types and their order private static final StreamResources[] STREAMS = { @@ -256,14 +252,14 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie } - public VolumePanel(final Context context, AudioService volumeService) { + public VolumePanel(Context context, AudioService volumeService) { mContext = context; mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); mAudioService = volumeService; // For now, only show master volume if master volume is supported - final boolean useMasterVolume = context.getResources().getBoolean( - R.bool.config_useMasterVolume); + final Resources res = context.getResources(); + final boolean useMasterVolume = res.getBoolean(R.bool.config_useMasterVolume); if (useMasterVolume) { for (int i = 0; i < STREAMS.length; i++) { StreamResources streamRes = STREAMS[i]; @@ -271,29 +267,7 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie } } - final TypedArray a = context.obtainStyledAttributes(null, - com.android.internal.R.styleable.AlertDialog, - com.android.internal.R.attr.alertDialogStyle, 0); - final Drawable background = a.getDrawable(R.styleable.AlertDialog_fullBright); - a.recycle(); - - final LayoutInflater inflater = (LayoutInflater) context.getSystemService( - Context.LAYOUT_INFLATER_SERVICE); - mView = inflater.inflate(R.layout.volume_adjust, null); - mView.setBackground(background); - mView.setOnTouchListener(new View.OnTouchListener() { - @Override - public boolean onTouch(View v, MotionEvent event) { - resetTimeout(); - return false; - } - }); - mPanel = (ViewGroup) mView.findViewById(R.id.visible_panel); - mSliderGroup = (ViewGroup) mView.findViewById(R.id.slider_group); - mMoreButton = mView.findViewById(R.id.expand_button); - mDivider = mView.findViewById(R.id.expand_button_divider); - - mDialog = new Dialog(context, R.style.Theme_Panel_Volume) { + mDialog = new Dialog(context) { @Override public boolean onTouchEvent(MotionEvent event) { if (isShowing() && event.getAction() == MotionEvent.ACTION_OUTSIDE && @@ -304,51 +278,65 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie return false; } }; - - mDialog.setTitle("Volume control"); // No need to localize - mDialog.setContentView(mView); - mDialog.setOnDismissListener(new OnDismissListener() { - @Override - public void onDismiss(DialogInterface dialog) { - mActiveStreamType = -1; - mAudioManager.forceVolumeControlStream(mActiveStreamType); - } - }); // Change some window properties final Window window = mDialog.getWindow(); - window.setGravity(Gravity.TOP); - final LayoutParams lp = window.getAttributes(); lp.token = null; // Offset from the top - lp.y = mContext.getResources().getDimensionPixelOffset(R.dimen.volume_panel_top); + lp.y = res.getDimensionPixelOffset(R.dimen.volume_panel_top); lp.type = LayoutParams.TYPE_VOLUME_OVERLAY; - lp.width = LayoutParams.WRAP_CONTENT; - lp.height = LayoutParams.WRAP_CONTENT; + lp.windowAnimations = R.style.Animation_VolumePanel; window.setAttributes(lp); - window.addFlags(LayoutParams.FLAG_NOT_FOCUSABLE | LayoutParams.FLAG_NOT_TOUCH_MODAL + window.setGravity(Gravity.TOP); + window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); + window.requestFeature(Window.FEATURE_NO_TITLE); + window.addFlags(LayoutParams.FLAG_NOT_FOCUSABLE + | LayoutParams.FLAG_NOT_TOUCH_MODAL | LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH); - mToneGenerators = new ToneGenerator[AudioSystem.getNumStreamTypes()]; - mVibrator = (Vibrator)context.getSystemService(Context.VIBRATOR_SERVICE); + mDialog.setCanceledOnTouchOutside(true); + mDialog.setContentView(R.layout.volume_adjust); + mDialog.setOnDismissListener(new OnDismissListener() { + @Override + public void onDismiss(DialogInterface dialog) { + mActiveStreamType = -1; + mAudioManager.forceVolumeControlStream(mActiveStreamType); + } + }); + + mDialog.create(); + mView = window.findViewById(R.id.content); + mView.setOnTouchListener(new View.OnTouchListener() { + @Override + public boolean onTouch(View v, MotionEvent event) { + resetTimeout(); + return false; + } + }); + + mPanel = (ViewGroup) mView.findViewById(R.id.visible_panel); + mSliderGroup = (ViewGroup) mView.findViewById(R.id.slider_group); + mMoreButton = mView.findViewById(R.id.expand_button); + mDivider = mView.findViewById(R.id.expand_button_divider); + + mToneGenerators = new ToneGenerator[AudioSystem.getNumStreamTypes()]; + mVibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE); mVoiceCapable = context.getResources().getBoolean(R.bool.config_voice_capable); + + // If we don't want to show multiple volumes, hide the settings button + // and divider. mShowCombinedVolumes = !mVoiceCapable && !useMasterVolume; - - // If we don't want to show multiple volumes, hide the settings button and divider if (!mShowCombinedVolumes) { mMoreButton.setVisibility(View.GONE); mDivider.setVisibility(View.GONE); } else { - mMoreButton.setOnClickListener(this); + mMoreButton.setOnClickListener(mClickListener); } - final boolean masterVolumeOnly = context.getResources().getBoolean( - R.bool.config_useMasterVolume); - final boolean masterVolumeKeySounds = mContext.getResources().getBoolean( - R.bool.config_useVolumeKeySounds); - + final boolean masterVolumeOnly = res.getBoolean(R.bool.config_useMasterVolume); + final boolean masterVolumeKeySounds = res.getBoolean(R.bool.config_useVolumeKeySounds); mPlayMasterStreamTones = masterVolumeOnly && masterVolumeKeySounds; listenToRingerMode(); @@ -444,7 +432,7 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie final int plusOne = (streamType == AudioSystem.STREAM_BLUETOOTH_SCO || streamType == AudioSystem.STREAM_VOICE_CALL) ? 1 : 0; sc.seekbarView.setMax(getStreamMaxVolume(streamType) + plusOne); - sc.seekbarView.setOnSeekBarChangeListener(this); + sc.seekbarView.setOnSeekBarChangeListener(mSeekListener); sc.seekbarView.setTag(sc); mStreamControls.put(streamType, sc); } @@ -506,10 +494,6 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie } } - private boolean isExpanded() { - return mMoreButton.getVisibility() != View.VISIBLE; - } - private void expand() { final int count = mSliderGroup.getChildCount(); for (int i = 0; i < count; i++) { @@ -547,6 +531,7 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie obtainMessage(MSG_VOLUME_CHANGED, streamType, flags).sendToTarget(); } + @Override public void postRemoteVolumeChanged(int streamType, int flags) { if (hasMessages(MSG_REMOTE_VOLUME_CHANGED)) return; synchronized (this) { @@ -558,6 +543,7 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie obtainMessage(MSG_REMOTE_VOLUME_CHANGED, streamType, flags).sendToTarget(); } + @Override public void postRemoteSliderVisibility(boolean visible) { obtainMessage(MSG_SLIDER_VISIBILITY_CHANGED, AudioService.STREAM_REMOTE_MUSIC, visible ? 1 : 0).sendToTarget(); @@ -574,6 +560,7 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie * as a request to update the volume), the application will likely set a new volume. If the UI * is still up, we need to refresh the display to show this new value. */ + @Override public void postHasNewRemotePlaybackInfo() { if (hasMessages(MSG_REMOTE_VOLUME_UPDATE_IF_SHOWN)) return; // don't create or prevent resources to be freed, if they disappear, this update came too @@ -753,7 +740,7 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie int stream = (streamType == AudioService.STREAM_REMOTE_MUSIC) ? -1 : streamType; // when the stream is for remote playback, use -1 to reset the stream type evaluation mAudioManager.forceVolumeControlStream(stream); - mDialog.setContentView(mView); + // Showing dialog - use collapsed state if (mShowCombinedVolumes) { collapse(); @@ -885,6 +872,7 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie .setMessage(com.android.internal.R.string.safe_media_volume_warning) .setPositiveButton(com.android.internal.R.string.yes, new DialogInterface.OnClickListener() { + @Override public void onClick(DialogInterface dialog, int which) { mAudioService.disableSafeMediaVolume(); } @@ -1041,39 +1029,48 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie sendMessage(obtainMessage(MSG_TIMEOUT)); } - public void onProgressChanged(SeekBar seekBar, int progress, - boolean fromUser) { - final Object tag = seekBar.getTag(); - if (fromUser && tag instanceof StreamControl) { - StreamControl sc = (StreamControl) tag; - if (getStreamVolume(sc.streamType) != progress) { - setStreamVolume(sc.streamType, progress, 0); + private final OnSeekBarChangeListener mSeekListener = new OnSeekBarChangeListener() { + @Override + public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { + final Object tag = seekBar.getTag(); + if (fromUser && tag instanceof StreamControl) { + StreamControl sc = (StreamControl) tag; + if (getStreamVolume(sc.streamType) != progress) { + setStreamVolume(sc.streamType, progress, 0); + } } + resetTimeout(); } - resetTimeout(); - } - public void onStartTrackingTouch(SeekBar seekBar) { - } + @Override + public void onStartTrackingTouch(SeekBar seekBar) { + } - public void onStopTrackingTouch(SeekBar seekBar) { - final Object tag = seekBar.getTag(); - if (tag instanceof StreamControl) { - StreamControl sc = (StreamControl) tag; - // because remote volume updates are asynchronous, AudioService might have received - // a new remote volume value since the finger adjusted the slider. So when the - // progress of the slider isn't being tracked anymore, adjust the slider to the last - // "published" remote volume value, so the UI reflects the actual volume. - if (sc.streamType == AudioService.STREAM_REMOTE_MUSIC) { - seekBar.setProgress(getStreamVolume(AudioService.STREAM_REMOTE_MUSIC)); + @Override + public void onStopTrackingTouch(SeekBar seekBar) { + final Object tag = seekBar.getTag(); + if (tag instanceof StreamControl) { + StreamControl sc = (StreamControl) tag; + // Because remote volume updates are asynchronous, AudioService + // might have received a new remote volume value since the + // finger adjusted the slider. So when the progress of the + // slider isn't being tracked anymore, adjust the slider to the + // last "published" remote volume value, so the UI reflects the + // actual volume. + if (sc.streamType == AudioService.STREAM_REMOTE_MUSIC) { + seekBar.setProgress(getStreamVolume(AudioService.STREAM_REMOTE_MUSIC)); + } } } - } + }; - public void onClick(View v) { - if (v == mMoreButton) { - expand(); + private final View.OnClickListener mClickListener = new View.OnClickListener() { + @Override + public void onClick(View v) { + if (v == mMoreButton) { + expand(); + } + resetTimeout(); } - resetTimeout(); - } + }; } diff --git a/core/java/com/android/internal/view/BaseIWindow.java b/core/java/com/android/internal/view/BaseIWindow.java index 02bd4ac..86c9fe3 100644 --- a/core/java/com/android/internal/view/BaseIWindow.java +++ b/core/java/com/android/internal/view/BaseIWindow.java @@ -57,10 +57,6 @@ public class BaseIWindow extends IWindow.Stub { } @Override - public void dispatchScreenState(boolean on) { - } - - @Override public void windowFocusChanged(boolean hasFocus, boolean touchEnabled) { } diff --git a/core/res/res/layout/volume_adjust.xml b/core/res/res/layout/volume_adjust.xml index 1cf7ca9..3ad1f23 100644 --- a/core/res/res/layout/volume_adjust.xml +++ b/core/res/res/layout/volume_adjust.xml @@ -14,42 +14,38 @@ limitations under the License. --> -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="448dp" +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/visible_panel" + android:orientation="horizontal" + android:layout_width="300dp" android:layout_height="wrap_content"> + <LinearLayout - android:id="@+id/visible_panel" - android:layout_width="match_parent" + android:id="@+id/slider_group" + android:layout_width="0dp" android:layout_height="wrap_content" - android:orientation="horizontal"> - - <LinearLayout - android:id="@+id/slider_group" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="1" - android:orientation="vertical"> - <!-- Sliders go here --> - </LinearLayout> + android:layout_weight="1" + android:orientation="vertical"> + <!-- Sliders go here --> + </LinearLayout> - <ImageView - android:id="@+id/expand_button_divider" - android:src="?attr/dividerVertical" - android:layout_width="wrap_content" - android:layout_height="32dip" - android:scaleType="fitXY" - android:layout_gravity="top" - android:layout_marginTop="16dip" - android:layout_marginBottom="16dip" /> + <ImageView + android:id="@+id/expand_button_divider" + android:src="?attr/dividerVertical" + android:layout_width="wrap_content" + android:layout_height="32dip" + android:scaleType="fitXY" + android:layout_gravity="top" + android:layout_marginTop="16dip" + android:layout_marginBottom="16dip" /> - <ImageView - android:id="@+id/expand_button" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="top" - android:padding="16dip" - android:background="?attr/selectableItemBackground" - android:src="@drawable/ic_sysbar_quicksettings" /> + <ImageView + android:id="@+id/expand_button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="top" + android:padding="16dip" + android:background="?attr/selectableItemBackground" + android:src="@drawable/ic_sysbar_quicksettings" /> - </LinearLayout> -</FrameLayout>
\ No newline at end of file +</LinearLayout> diff --git a/core/res/res/layout/volume_adjust_item.xml b/core/res/res/layout/volume_adjust_item.xml index 746cf91..57cecf4 100644 --- a/core/res/res/layout/volume_adjust_item.xml +++ b/core/res/res/layout/volume_adjust_item.xml @@ -33,8 +33,9 @@ <SeekBar style="?android:attr/seekBarStyle" android:id="@+id/seekbar" - android:layout_width="252dp" + android:layout_width="0dp" android:layout_height="wrap_content" + android:layout_weight="1" android:padding="16dip" android:layout_marginEnd="16dip" /> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 8a11a8b..f285bce 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -1254,7 +1254,6 @@ <java-symbol type="style" name="TextAppearance.SlidingTabNormal" /> <java-symbol type="style" name="Theme.DeviceDefault.Dialog.NoFrame" /> <java-symbol type="style" name="Theme.IconMenu" /> - <java-symbol type="style" name="Theme.Panel.Volume" /> <java-symbol type="attr" name="mediaRouteButtonStyle" /> <java-symbol type="attr" name="externalRouteEnabledDrawable" /> @@ -1838,5 +1837,6 @@ <java-symbol type="attr" name="subtitleTextAppearance" /> <java-symbol type="drawable" name="ic_lock_bugreport" /> <java-symbol type="id" name="icon_frame" /> + <java-symbol type="style" name="Animation.VolumePanel" /> </resources> diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml index 6f9e55b..7b3d5e3 100644 --- a/core/res/res/values/themes.xml +++ b/core/res/res/values/themes.xml @@ -892,11 +892,6 @@ please see themes_device_defaults.xml. <item name="android:windowCloseOnTouchOutside">false</item> </style> - <style name="Theme.Panel.Volume"> - <item name="android:windowAnimationStyle">@android:style/Animation.VolumePanel</item> - <item name="android:windowCloseOnTouchOutside">true</item> - </style> - <!-- Default theme with an Action Bar. --> <style name="Theme.WithActionBar"> <item name="android:windowActionBar">true</item> diff --git a/graphics/java/android/graphics/drawable/VectorDrawable.java b/graphics/java/android/graphics/drawable/VectorDrawable.java index 3e68574..493e276 100644 --- a/graphics/java/android/graphics/drawable/VectorDrawable.java +++ b/graphics/java/android/graphics/drawable/VectorDrawable.java @@ -1997,8 +1997,8 @@ public class VectorDrawable extends Drawable { } path.rQuadTo(reflectiveCtrlPointX, reflectiveCtrlPointY, val[k + 0], val[k + 1]); - ctrlPointX = reflectiveCtrlPointX; - ctrlPointY = reflectiveCtrlPointY; + ctrlPointX = currentX + reflectiveCtrlPointX; + ctrlPointY = currentY + reflectiveCtrlPointY; currentX += val[k + 0]; currentY += val[k + 1]; break; diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp index 140a07a..6c73d68 100644 --- a/libs/hwui/DisplayListRenderer.cpp +++ b/libs/hwui/DisplayListRenderer.cpp @@ -258,11 +258,11 @@ status_t DisplayListRenderer::drawBitmapData(const SkBitmap* bitmap, float left, status_t DisplayListRenderer::drawBitmapMesh(const SkBitmap* bitmap, int meshWidth, int meshHeight, const float* vertices, const int* colors, const SkPaint* paint) { - int count = (meshWidth + 1) * (meshHeight + 1) * 2; + int vertexCount = (meshWidth + 1) * (meshHeight + 1); bitmap = refBitmap(bitmap); - vertices = refBuffer<float>(vertices, count); + vertices = refBuffer<float>(vertices, vertexCount * 2); // 2 floats per vertex paint = refPaint(paint); - colors = refBuffer<int>(colors, count); + colors = refBuffer<int>(colors, vertexCount); // 1 color per vertex addDrawOp(new (alloc()) DrawBitmapMeshOp(bitmap, meshWidth, meshHeight, vertices, colors, paint)); diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp index 2489c92..c55ebd6 100644 --- a/libs/hwui/RenderNode.cpp +++ b/libs/hwui/RenderNode.cpp @@ -50,17 +50,13 @@ void RenderNode::outputLogBuffer(int fd) { } RenderNode::RenderNode() - : mDestroyed(false) - , mNeedsPropertiesSync(false) + : mNeedsPropertiesSync(false) , mNeedsDisplayListDataSync(false) , mDisplayListData(0) , mStagingDisplayListData(0) { } RenderNode::~RenderNode() { - LOG_ALWAYS_FATAL_IF(mDestroyed, "Double destroyed DisplayList %p", this); - - mDestroyed = true; delete mDisplayListData; delete mStagingDisplayListData; } @@ -525,10 +521,6 @@ void RenderNode::issueOperationsOfProjectedChildren(OpenGLRenderer& renderer, T& template <class T> void RenderNode::issueOperations(OpenGLRenderer& renderer, T& handler) { const int level = handler.level(); - if (CC_UNLIKELY(mDestroyed)) { // temporary debug logging - ALOGW("Error: %s is drawing after destruction", mName.string()); - CRASH(); - } if (mDisplayListData->isEmpty() || properties().getAlpha() <= 0) { DISPLAY_LIST_LOGD("%*sEmpty display list (%p, %s)", level * 2, "", this, mName.string()); return; diff --git a/libs/hwui/RenderNode.h b/libs/hwui/RenderNode.h index 7853701..9e6ee3f 100644 --- a/libs/hwui/RenderNode.h +++ b/libs/hwui/RenderNode.h @@ -210,7 +210,6 @@ private: void prepareSubTree(TreeInfo& info, DisplayListData* subtree); String8 mName; - bool mDestroyed; // used for debugging crash, TODO: remove once invalid state crash fixed bool mNeedsPropertiesSync; RenderProperties mProperties; diff --git a/packages/Keyguard/AndroidManifest.xml b/packages/Keyguard/AndroidManifest.xml index af51fe6..352317d 100644 --- a/packages/Keyguard/AndroidManifest.xml +++ b/packages/Keyguard/AndroidManifest.xml @@ -44,8 +44,7 @@ <application android:label="@string/app_name" android:process="com.android.systemui" android:persistent="true" - android:supportsRtl="true" - android:requiredForProfile="all"> + android:supportsRtl="true"> </application> </manifest> diff --git a/packages/SystemUI/res/layout/quick_settings_brightness_dialog.xml b/packages/SystemUI/res/layout/quick_settings_brightness_dialog.xml index 46fbaff..b7df51d 100644 --- a/packages/SystemUI/res/layout/quick_settings_brightness_dialog.xml +++ b/packages/SystemUI/res/layout/quick_settings_brightness_dialog.xml @@ -22,7 +22,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" - android:paddingEnd="10dp" + android:layout_marginEnd="8dp" android:src="@drawable/ic_qs_brightness_auto_off" android:contentDescription="@null" /> @@ -31,7 +31,6 @@ android:layout_width="0dp" android:layout_height="40dp" android:layout_gravity="center_vertical" - android:layout_marginEnd="2dp" android:layout_weight="1" systemui:text="@string/status_bar_settings_auto_brightness_label" /> diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml index c2d584b..8ab646d 100644 --- a/packages/SystemUI/res/values/styles.xml +++ b/packages/SystemUI/res/values/styles.xml @@ -137,10 +137,9 @@ <style name="BaseBrightnessDialogContainer"> <item name="android:layout_width">match_parent</item> <item name="android:layout_height">wrap_content</item> - <item name="android:layout_marginLeft">8dp</item> - <item name="android:layout_marginRight">8dp</item> <item name="android:padding">16dp</item> </style> + <style name="BrightnessDialogContainer" parent="@style/BaseBrightnessDialogContainer" /> <style name="Animation" /> diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index b999954..ad256c8 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -6981,7 +6981,6 @@ public class WindowManagerService extends IWindowManager.Stub if (mDisplayEnabled) { mInputMonitor.setEventDispatchingLw(enabled); } - sendScreenStatusToClientsLocked(); } } @@ -7086,23 +7085,6 @@ public class WindowManagerService extends IWindowManager.Stub mPolicy.systemReady(); } - // TODO(multidisplay): Call isScreenOn for each display. - private void sendScreenStatusToClientsLocked() { - final boolean on = mPowerManager.isScreenOn(); - final int numDisplays = mDisplayContents.size(); - for (int displayNdx = 0; displayNdx < numDisplays; ++displayNdx) { - final WindowList windows = mDisplayContents.valueAt(displayNdx).getWindowList(); - final int numWindows = windows.size(); - for (int winNdx = 0; winNdx < numWindows; ++winNdx) { - try { - windows.get(winNdx).mClient.dispatchScreenState(on); - } catch (RemoteException e) { - // Ignored - } - } - } - } - // ------------------------------------------------------------- // Async Handler // ------------------------------------------------------------- diff --git a/tests/HwAccelerationTest/AndroidManifest.xml b/tests/HwAccelerationTest/AndroidManifest.xml index c8eefe0..0ad3456 100644 --- a/tests/HwAccelerationTest/AndroidManifest.xml +++ b/tests/HwAccelerationTest/AndroidManifest.xml @@ -867,14 +867,5 @@ </intent-filter> </activity> - <activity - android:name="IsolationVolumeActivity" - android:label="Reordering/IsolationVolume"> - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> - </intent-filter> - </activity> - </application> </manifest> diff --git a/tests/HwAccelerationTest/res/layout/isolation.xml b/tests/HwAccelerationTest/res/layout/isolation.xml deleted file mode 100644 index e66db19..0000000 --- a/tests/HwAccelerationTest/res/layout/isolation.xml +++ /dev/null @@ -1,56 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="#f55"> - <!-- Left and right layouts are not isolated volumes, so the text views - will interleave since they share an isolated z volume--> - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - <LinearLayout - android:layout_width="0dp" - android:layout_height="200dp" - android:layout_weight="1" - android:orientation="vertical"> - <TextView style="@style/TopLeftReorderTextView"/> - <TextView style="@style/BottomLeftReorderTextView"/> - </LinearLayout> - <LinearLayout - android:layout_width="0dp" - android:layout_height="200dp" - android:layout_weight="1" - android:translationY="50dp" - android:orientation="vertical"> - <TextView style="@style/TopRightReorderTextView"/> - <TextView style="@style/BottomRightReorderTextView"/> - </LinearLayout> - </LinearLayout> - - <!-- Left and right volumes are isolated by default, so no interleaving will be seen. --> - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - <LinearLayout - android:layout_width="0dp" - android:layout_height="200dp" - android:layout_weight="1" - android:orientation="vertical"> - <TextView style="@style/TopLeftReorderTextView"/> - <TextView style="@style/BottomLeftReorderTextView"/> - </LinearLayout> - <LinearLayout - android:layout_width="0dp" - android:layout_height="200dp" - android:layout_weight="1" - android:translationY="50dp" - android:orientation="vertical"> - <TextView style="@style/TopRightReorderTextView"/> - <TextView style="@style/BottomRightReorderTextView"/> - </LinearLayout> - </LinearLayout> -</LinearLayout>
\ No newline at end of file diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/IsolationVolumeActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/IsolationVolumeActivity.java deleted file mode 100644 index d5c93f2..0000000 --- a/tests/HwAccelerationTest/src/com/android/test/hwui/IsolationVolumeActivity.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.android.test.hwui; - -import android.os.Bundle; -import android.app.Activity; - -public class IsolationVolumeActivity extends Activity { - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.isolation); - } -} diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindow.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindow.java index df576d2..d32f6ee 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindow.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindow.java @@ -58,11 +58,6 @@ public final class BridgeWindow implements IWindow { } @Override - public void dispatchScreenState(boolean on) throws RemoteException { - // pass for now. - } - - @Override public void windowFocusChanged(boolean arg0, boolean arg1) throws RemoteException { // pass for now. } |