diff options
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/app/ContextImpl.java | 35 | ||||
-rw-r--r-- | core/java/android/app/DownloadManager.java | 5 | ||||
-rw-r--r-- | core/java/android/os/IPowerManager.aidl | 3 | ||||
-rw-r--r-- | core/java/android/provider/MediaStore.java | 9 | ||||
-rw-r--r-- | core/java/android/provider/Settings.java | 9 | ||||
-rw-r--r-- | core/java/android/view/IWindowManager.aidl | 3 | ||||
-rw-r--r-- | core/java/android/view/SurfaceView.java | 3 | ||||
-rw-r--r-- | core/java/android/view/ViewRootImpl.java | 12 | ||||
-rw-r--r-- | core/java/android/view/Window.java | 13 | ||||
-rw-r--r-- | core/java/android/view/WindowManager.java | 6 | ||||
-rw-r--r-- | core/java/android/view/WindowManagerPolicy.java | 23 | ||||
-rw-r--r-- | core/java/android/widget/AbsListView.java | 26 | ||||
-rw-r--r-- | core/java/android/widget/EdgeEffect.java | 10 | ||||
-rw-r--r-- | core/java/com/android/internal/app/PlatLogoActivity.java | 10 |
14 files changed, 121 insertions, 46 deletions
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java index 300424c..7183179 100644 --- a/core/java/android/app/ContextImpl.java +++ b/core/java/android/app/ContextImpl.java @@ -817,6 +817,10 @@ class ContextImpl extends Context { } if (!mFilesDir.exists()) { if(!mFilesDir.mkdirs()) { + if (mFilesDir.exists()) { + // spurious failure; probably racing with another process for this app + return mFilesDir; + } Log.w(TAG, "Unable to create files directory " + mFilesDir.getPath()); return null; } @@ -879,6 +883,10 @@ class ContextImpl extends Context { } if (!mCacheDir.exists()) { if(!mCacheDir.mkdirs()) { + if (mCacheDir.exists()) { + // spurious failure; probably racing with another process for this app + return mCacheDir; + } Log.w(TAG, "Unable to create cache directory " + mCacheDir.getAbsolutePath()); return null; } @@ -2136,18 +2144,21 @@ class ContextImpl extends Context { File dir = dirs[i]; if (!dir.exists()) { if (!dir.mkdirs()) { - // Failing to mkdir() may be okay, since we might not have - // enough permissions; ask vold to create on our behalf. - final IMountService mount = IMountService.Stub.asInterface( - ServiceManager.getService("mount")); - int res = -1; - try { - res = mount.mkdirs(getPackageName(), dir.getAbsolutePath()); - } catch (RemoteException e) { - } - if (res != 0) { - Log.w(TAG, "Failed to ensure directory: " + dir); - dir = null; + // recheck existence in case of cross-process race + if (!dir.exists()) { + // Failing to mkdir() may be okay, since we might not have + // enough permissions; ask vold to create on our behalf. + final IMountService mount = IMountService.Stub.asInterface( + ServiceManager.getService("mount")); + int res = -1; + try { + res = mount.mkdirs(getPackageName(), dir.getAbsolutePath()); + } catch (RemoteException e) { + } + if (res != 0) { + Log.w(TAG, "Failed to ensure directory: " + dir); + dir = null; + } } } } diff --git a/core/java/android/app/DownloadManager.java b/core/java/android/app/DownloadManager.java index 800ead9..b741cc5 100644 --- a/core/java/android/app/DownloadManager.java +++ b/core/java/android/app/DownloadManager.java @@ -16,6 +16,8 @@ package android.app; +import android.annotation.SdkConstant; +import android.annotation.SdkConstant.SdkConstantType; import android.content.ContentResolver; import android.content.ContentUris; import android.content.ContentValues; @@ -267,18 +269,21 @@ public class DownloadManager { /** * Broadcast intent action sent by the download manager when a download completes. */ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public final static String ACTION_DOWNLOAD_COMPLETE = "android.intent.action.DOWNLOAD_COMPLETE"; /** * Broadcast intent action sent by the download manager when the user clicks on a running * download, either from a system notification or from the downloads UI. */ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public final static String ACTION_NOTIFICATION_CLICKED = "android.intent.action.DOWNLOAD_NOTIFICATION_CLICKED"; /** * Intent action to launch an activity to display all downloads. */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public final static String ACTION_VIEW_DOWNLOADS = "android.intent.action.VIEW_DOWNLOADS"; /** diff --git a/core/java/android/os/IPowerManager.aidl b/core/java/android/os/IPowerManager.aidl index 23492ff..4c7bbb4 100644 --- a/core/java/android/os/IPowerManager.aidl +++ b/core/java/android/os/IPowerManager.aidl @@ -23,9 +23,10 @@ import android.os.WorkSource; interface IPowerManager { - // WARNING: The first two methods must remain the first two methods because their + // WARNING: The first three methods must remain the first three methods because their // transaction numbers must not change unless IPowerManager.cpp is also updated. void acquireWakeLock(IBinder lock, int flags, String tag, String packageName, in WorkSource ws); + void acquireWakeLockWithUid(IBinder lock, int flags, String tag, String packageName, int uidtoblame); void releaseWakeLock(IBinder lock, int flags); void updateWakeLockWorkSource(IBinder lock, in WorkSource ws); diff --git a/core/java/android/provider/MediaStore.java b/core/java/android/provider/MediaStore.java index ad6839b..f69cad0 100644 --- a/core/java/android/provider/MediaStore.java +++ b/core/java/android/provider/MediaStore.java @@ -118,6 +118,7 @@ public final class MediaStore { * sense for apps that can support large-scale search of music, such as services connected * to an online database of music which can be streamed and played on the device. */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH = "android.media.action.MEDIA_PLAY_FROM_SEARCH"; @@ -134,6 +135,7 @@ public final class MediaStore { * sense for apps that can support large-scale search of text media, such as services connected * to an online database of books and/or magazines which can be read on the device. */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String INTENT_ACTION_TEXT_OPEN_FROM_SEARCH = "android.media.action.TEXT_OPEN_FROM_SEARCH"; @@ -150,6 +152,7 @@ public final class MediaStore { * sense for apps that can support large-scale search of video, such as services connected to an * online database of videos which can be streamed and played on the device. */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String INTENT_ACTION_VIDEO_PLAY_FROM_SEARCH = "android.media.action.VIDEO_PLAY_FROM_SEARCH"; @@ -202,6 +205,7 @@ public final class MediaStore { /** * The name of the Intent action used to launch a camera in still image mode. */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String INTENT_ACTION_STILL_IMAGE_CAMERA = "android.media.action.STILL_IMAGE_CAMERA"; /** @@ -216,12 +220,14 @@ public final class MediaStore { * this flag is used, so launching more than one activity is strongly * discouraged. */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE = "android.media.action.STILL_IMAGE_CAMERA_SECURE"; /** * The name of the Intent action used to launch a camera in video mode. */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String INTENT_ACTION_VIDEO_CAMERA = "android.media.action.VIDEO_CAMERA"; /** @@ -235,6 +241,7 @@ public final class MediaStore { * value of EXTRA_OUTPUT. * @see #EXTRA_OUTPUT */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public final static String ACTION_IMAGE_CAPTURE = "android.media.action.IMAGE_CAPTURE"; /** @@ -256,6 +263,7 @@ public final class MediaStore { * @see #ACTION_IMAGE_CAPTURE * @see #EXTRA_OUTPUT */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_IMAGE_CAPTURE_SECURE = "android.media.action.IMAGE_CAPTURE_SECURE"; @@ -274,6 +282,7 @@ public final class MediaStore { * @see #EXTRA_SIZE_LIMIT * @see #EXTRA_DURATION_LIMIT */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public final static String ACTION_VIDEO_CAPTURE = "android.media.action.VIDEO_CAPTURE"; /** diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 3769e1e..631a38f 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -2407,6 +2407,15 @@ public final class Settings { public static final String POINTER_SPEED = "pointer_speed"; /** + * I am the lolrus. + * <p> + * Nonzero values indicate that the user has a bukkit. + * Backward-compatible with <code>PrefGetPreference(prefAllowEasterEggs)</code>. + * @hide + */ + public static final String EGG_MODE = "egg_mode"; + + /** * Settings to backup. This is here so that it's in the same place as the settings * keys and easy to update. * diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl index caf9c8b..fd45866 100644 --- a/core/java/android/view/IWindowManager.aidl +++ b/core/java/android/view/IWindowManager.aidl @@ -205,7 +205,8 @@ interface IWindowManager /** * Create a screenshot of the applications currently displayed. */ - Bitmap screenshotApplications(IBinder appToken, int displayId, int maxWidth, int maxHeight); + Bitmap screenshotApplications(IBinder appToken, int displayId, int maxWidth, + int maxHeight, boolean force565); /** * Called by the status bar to notify Views of changes to System UI visiblity. diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java index 4366fb7..22d4c9b 100644 --- a/core/java/android/view/SurfaceView.java +++ b/core/java/android/view/SurfaceView.java @@ -478,7 +478,8 @@ public class SurfaceView extends View { | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE ; if (!getContext().getResources().getCompatibilityInfo().supportsScreen()) { - mLayout.flags |= WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW; + mLayout.privateFlags |= + WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW; } mLayout.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION; diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 89c74f1..7e3ee5f 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -467,7 +467,7 @@ public final class ViewRootImpl implements ViewParent, if (DEBUG_LAYOUT) Log.d(TAG, "WindowLayout in setView:" + attrs); if (!compatibilityInfo.supportsScreen()) { - attrs.flags |= WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW; + attrs.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW; mLastInCompatMode = true; } @@ -748,8 +748,8 @@ public final class ViewRootImpl implements ViewParent, // Keep track of the actual window flags supplied by the client. mClientWindowLayoutFlags = attrs.flags; // preserve compatible window flag if exists. - int compatibleWindowFlag = - mWindowAttributes.flags & WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW; + int compatibleWindowFlag = mWindowAttributes.privateFlags + & WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW; // transfer over system UI visibility values as they carry current state. attrs.systemUiVisibility = mWindowAttributes.systemUiVisibility; attrs.subtreeSystemUiVisibility = mWindowAttributes.subtreeSystemUiVisibility; @@ -757,7 +757,7 @@ public final class ViewRootImpl implements ViewParent, if (mWindowAttributes.packageName == null) { mWindowAttributes.packageName = mBasePackageName; } - mWindowAttributes.flags |= compatibleWindowFlag; + mWindowAttributes.privateFlags |= compatibleWindowFlag; applyKeepScreenOnFlag(mWindowAttributes); @@ -1146,10 +1146,10 @@ public final class ViewRootImpl implements ViewParent, mFullRedrawNeeded = true; mLayoutRequested = true; if (mLastInCompatMode) { - params.flags &= ~WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW; + params.privateFlags &= ~WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW; mLastInCompatMode = false; } else { - params.flags |= WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW; + params.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW; mLastInCompatMode = true; } } diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java index 7a24243..b3a0699 100644 --- a/core/java/android/view/Window.java +++ b/core/java/android/view/Window.java @@ -708,6 +708,11 @@ public abstract class Window { public void addFlags(int flags) { setFlags(flags, flags); } + + /** @hide */ + public void addPrivateFlags(int flags) { + setPrivateFlags(flags, flags); + } /** * Convenience function to clear the flag bits as specified in flags, as @@ -751,6 +756,14 @@ public abstract class Window { } } + private void setPrivateFlags(int flags, int mask) { + final WindowManager.LayoutParams attrs = getAttributes(); + attrs.privateFlags = (attrs.privateFlags & ~mask) | (flags & mask); + if (mCallback != null) { + mCallback.onWindowAttributesChanged(attrs); + } + } + /** * Set the amount of dim behind the window when using * {@link WindowManager.LayoutParams#FLAG_DIM_BEHIND}. This overrides diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index 53f4d77..815b97c 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -1754,6 +1754,9 @@ public interface WindowManager extends ViewManager { sb.append(" fl=#"); sb.append(Integer.toHexString(flags)); if (privateFlags != 0) { + if ((privateFlags & PRIVATE_FLAG_COMPATIBLE_WINDOW) != 0) { + sb.append(" compatible=true"); + } sb.append(" pfl=0x").append(Integer.toHexString(privateFlags)); } if (format != PixelFormat.OPAQUE) { @@ -1784,9 +1787,6 @@ public interface WindowManager extends ViewManager { sb.append(" rotAnim="); sb.append(rotationAnimation); } - if ((flags & PRIVATE_FLAG_COMPATIBLE_WINDOW) != 0) { - sb.append(" compatible=true"); - } if (systemUiVisibility != 0) { sb.append(" sysui=0x"); sb.append(Integer.toHexString(systemUiVisibility)); diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java index 79c0b3c..79aec90 100644 --- a/core/java/android/view/WindowManagerPolicy.java +++ b/core/java/android/view/WindowManagerPolicy.java @@ -165,9 +165,11 @@ public interface WindowManagerPolicy { * This can be used as a hint for scrolling (avoiding resizing) * the window to make certain that parts of its content * are visible. + * @param decorFrame The decor frame specified by policy specific to this window, + * to use for proper cropping during animation. */ public void computeFrameLw(Rect parentFrame, Rect displayFrame, - Rect overlayFrame, Rect contentFrame, Rect visibleFrame); + Rect overlayFrame, Rect contentFrame, Rect visibleFrame, Rect decorFrame); /** * Retrieve the current frame of the window that has been assigned by @@ -399,8 +401,8 @@ public interface WindowManagerPolicy { */ public FakeWindow addFakeWindow(Looper looper, InputEventReceiver.Factory inputEventReceiverFactory, - String name, int windowType, int layoutParamsFlags, boolean canReceiveKeys, - boolean hasFocus, boolean touchFullscreen); + String name, int windowType, int layoutParamsFlags, int layoutParamsPrivateFlags, + boolean canReceiveKeys, boolean hasFocus, boolean touchFullscreen); /** * Returns a code that describes the current state of the lid switch. @@ -815,19 +817,10 @@ public interface WindowManagerPolicy { int displayRotation); /** - * Return the rectangle of the screen currently covered by system decorations. - * This will be called immediately after {@link #layoutWindowLw}. It can - * fill in the rectangle to indicate any part of the screen that it knows - * for sure is covered by system decor such as the status bar. The rectangle - * is initially set to the actual size of the screen, indicating nothing is - * covered. - * - * @param systemRect The rectangle of the screen that is not covered by - * system decoration. - * @return Returns the layer above which the system rectangle should - * not be applied. + * Returns the bottom-most layer of the system decor, above which no policy decor should + * be applied. */ - public int getSystemDecorRectLw(Rect systemRect); + public int getSystemDecorLayerLw(); /** * Return the rectangle of the screen that is available for applications to run in. diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index 6f832cf..2e77578 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -2250,6 +2250,13 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te } } else { isScrap[0] = true; + + // Clear any system-managed transient state so that we can + // recycle this view and bind it to different data. + if (child.isAccessibilityFocused()) { + child.clearAccessibilityFocus(); + } + child.dispatchFinishTemporaryDetach(); } } else { @@ -5069,6 +5076,11 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te count++; int position = firstPosition + i; if (position >= headerViewsCount && position < footerViewsStart) { + // The view will be rebound to new data, clear any + // system-managed transient state. + if (child.isAccessibilityFocused()) { + child.clearAccessibilityFocus(); + } mRecycler.addScrapView(child, position); } } @@ -5087,6 +5099,11 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te count++; int position = firstPosition + i; if (position >= headerViewsCount && position < footerViewsStart) { + // The view will be rebound to new data, clear any + // system-managed transient state. + if (child.isAccessibilityFocused()) { + child.clearAccessibilityFocus(); + } mRecycler.addScrapView(child, position); } } @@ -6660,8 +6677,8 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te lp.scrappedFromPosition = position; - // Don't scrap header or footer views, or views that should - // otherwise not be recycled. + // Remove but don't scrap header or footer views, or views that + // should otherwise not be recycled. final int viewType = lp.viewType; if (!shouldRecycleViewType(viewType)) { return; @@ -6700,6 +6717,11 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te mScrapViews[viewType].add(scrap); } + // Clear any system-managed transient state. + if (scrap.isAccessibilityFocused()) { + scrap.clearAccessibilityFocus(); + } + scrap.setAccessibilityDelegate(null); if (mRecyclerListener != null) { diff --git a/core/java/android/widget/EdgeEffect.java b/core/java/android/widget/EdgeEffect.java index bb4a4cf..30752e0 100644 --- a/core/java/android/widget/EdgeEffect.java +++ b/core/java/android/widget/EdgeEffect.java @@ -68,6 +68,8 @@ public class EdgeEffect { // Minimum velocity that will be absorbed private static final int MIN_VELOCITY = 100; + // Maximum velocity, clamps at this value + private static final int MAX_VELOCITY = 10000; private static final float EPSILON = 0.001f; @@ -115,7 +117,7 @@ public class EdgeEffect { private static final float PULL_DISTANCE_ALPHA_GLOW_FACTOR = 1.1f; private static final int VELOCITY_EDGE_FACTOR = 8; - private static final int VELOCITY_GLOW_FACTOR = 16; + private static final int VELOCITY_GLOW_FACTOR = 12; private int mState = STATE_IDLE; @@ -283,10 +285,10 @@ public class EdgeEffect { */ public void onAbsorb(int velocity) { mState = STATE_ABSORB; - velocity = Math.max(MIN_VELOCITY, Math.abs(velocity)); + velocity = Math.min(Math.max(MIN_VELOCITY, Math.abs(velocity)), MAX_VELOCITY); mStartTime = AnimationUtils.currentAnimationTimeMillis(); - mDuration = 0.1f + (velocity * 0.03f); + mDuration = 0.15f + (velocity * 0.02f); // The edge should always be at least partially visible, regardless // of velocity. @@ -294,7 +296,7 @@ public class EdgeEffect { mEdgeScaleY = mEdgeScaleYStart = 0.f; // The glow depends more on the velocity, and therefore starts out // nearly invisible. - mGlowAlphaStart = 0.5f; + mGlowAlphaStart = 0.3f; mGlowScaleYStart = 0.f; // Factor the velocity by 8. Testing on device shows this works best to diff --git a/core/java/com/android/internal/app/PlatLogoActivity.java b/core/java/com/android/internal/app/PlatLogoActivity.java index 76b8579..43bd735 100644 --- a/core/java/com/android/internal/app/PlatLogoActivity.java +++ b/core/java/com/android/internal/app/PlatLogoActivity.java @@ -21,6 +21,7 @@ import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; import android.graphics.Typeface; +import android.provider.Settings; import android.os.Build; import android.os.Bundle; import android.os.Handler; @@ -151,6 +152,13 @@ public class PlatLogoActivity extends Activity { logo.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { + if (Settings.System.getLong(getContentResolver(), Settings.System.EGG_MODE, 0) + == 0) { + // For posterity: the moment this user unlocked the easter egg + Settings.System.putLong(getContentResolver(), + Settings.System.EGG_MODE, + System.currentTimeMillis()); + } try { startActivity(new Intent(Intent.ACTION_MAIN) .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK @@ -158,7 +166,7 @@ public class PlatLogoActivity extends Activity { | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) .addCategory("com.android.internal.category.PLATLOGO")); } catch (ActivityNotFoundException ex) { - android.util.Log.e("PlatLogoActivity", "Couldn't find a piece of pie."); + android.util.Log.e("PlatLogoActivity", "Couldn't catch a break."); } finish(); return true; |