summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/accessibilityservice/AccessibilityService.java2
-rw-r--r--core/java/android/app/Service.java4
-rwxr-xr-xcore/java/android/bluetooth/BluetoothA2dp.java4
-rwxr-xr-xcore/java/android/bluetooth/BluetoothHeadset.java4
-rwxr-xr-x[-rw-r--r--]core/java/android/bluetooth/BluetoothPbap.java69
-rwxr-xr-xcore/java/android/bluetooth/BluetoothProfile.java7
-rw-r--r--core/java/android/inputmethodservice/IInputMethodSessionWrapper.java17
-rw-r--r--core/java/android/inputmethodservice/IInputMethodWrapper.java10
-rw-r--r--core/java/android/os/Binder.java2
-rw-r--r--core/java/android/provider/Settings.java8
-rw-r--r--core/java/android/service/wallpaper/WallpaperService.java2
-rw-r--r--core/java/android/test/AndroidTestCase.java3
-rw-r--r--core/java/android/view/AccessibilityInteractionController.java87
-rw-r--r--core/java/android/view/GLES20RenderLayer.java10
-rw-r--r--core/java/android/view/GLES20TextureLayer.java5
-rw-r--r--core/java/android/view/HardwareLayer.java7
-rw-r--r--core/java/android/view/HardwareRenderer.java14
-rw-r--r--core/java/android/view/IWindow.aidl2
-rw-r--r--core/java/android/view/View.java17
-rw-r--r--core/java/android/view/ViewGroup.java15
-rw-r--r--core/java/android/view/ViewRootImpl.java80
-rw-r--r--core/java/android/view/inputmethod/InputMethodManager.java7
-rw-r--r--core/java/com/android/internal/os/HandlerCaller.java66
-rw-r--r--core/java/com/android/internal/os/SomeArgs.java95
-rw-r--r--core/java/com/android/internal/view/BaseIWindow.java2
-rw-r--r--core/java/com/android/internal/widget/ActionBarView.java10
26 files changed, 315 insertions, 234 deletions
diff --git a/core/java/android/accessibilityservice/AccessibilityService.java b/core/java/android/accessibilityservice/AccessibilityService.java
index b6001eb..81ee192 100644
--- a/core/java/android/accessibilityservice/AccessibilityService.java
+++ b/core/java/android/accessibilityservice/AccessibilityService.java
@@ -66,7 +66,7 @@ import com.android.internal.os.HandlerCaller;
* accessibility service. Following is an example declaration:
* </p>
* <pre> &lt;service android:name=".MyAccessibilityService"
- * android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE&gt;
+ * android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE"&gt;
* &lt;intent-filter&gt;
* &lt;action android:name="android.accessibilityservice.AccessibilityService" /&gt;
* &lt;/intent-filter&gt;
diff --git a/core/java/android/app/Service.java b/core/java/android/app/Service.java
index cb43d4c..02cf3aa 100644
--- a/core/java/android/app/Service.java
+++ b/core/java/android/app/Service.java
@@ -142,7 +142,7 @@ import java.io.PrintWriter;
* to the service. The service will remain running as long as the connection
* is established (whether or not the client retains a reference on the
* service's IBinder). Usually the IBinder returned is for a complex
- * interface that has been <a href="{@docRoot}guide/developing/tools/aidl.html">written
+ * interface that has been <a href="{@docRoot}guide/components/aidl.html">written
* in aidl</a>.
*
* <p>A service can be both started and have connections bound to it. In such
@@ -473,7 +473,7 @@ public abstract class Service extends ContextWrapper implements ComponentCallbac
* Return the communication channel to the service. May return null if
* clients can not bind to the service. The returned
* {@link android.os.IBinder} is usually for a complex interface
- * that has been <a href="{@docRoot}guide/developing/tools/aidl.html">described using
+ * that has been <a href="{@docRoot}guide/components/aidl.html">described using
* aidl</a>.
*
* <p><em>Note that unlike other application components, calls on to the
diff --git a/core/java/android/bluetooth/BluetoothA2dp.java b/core/java/android/bluetooth/BluetoothA2dp.java
index 1b415e5..6e2278d 100755
--- a/core/java/android/bluetooth/BluetoothA2dp.java
+++ b/core/java/android/bluetooth/BluetoothA2dp.java
@@ -337,9 +337,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
if (mService != null && isEnabled()
&& isValidDevice(device)) {
if (priority != BluetoothProfile.PRIORITY_OFF &&
- priority != BluetoothProfile.PRIORITY_ON &&
- priority != BluetoothProfile.PRIORITY_UNDEFINED &&
- priority != BluetoothProfile.PRIORITY_AUTO_CONNECT) {
+ priority != BluetoothProfile.PRIORITY_ON){
return false;
}
try {
diff --git a/core/java/android/bluetooth/BluetoothHeadset.java b/core/java/android/bluetooth/BluetoothHeadset.java
index 8e6ebaf..541b69f 100755
--- a/core/java/android/bluetooth/BluetoothHeadset.java
+++ b/core/java/android/bluetooth/BluetoothHeadset.java
@@ -455,9 +455,7 @@ public final class BluetoothHeadset implements BluetoothProfile {
if (mService != null && isEnabled() &&
isValidDevice(device)) {
if (priority != BluetoothProfile.PRIORITY_OFF &&
- priority != BluetoothProfile.PRIORITY_ON &&
- priority != BluetoothProfile.PRIORITY_UNDEFINED &&
- priority != BluetoothProfile.PRIORITY_AUTO_CONNECT) {
+ priority != BluetoothProfile.PRIORITY_ON) {
return false;
}
try {
diff --git a/core/java/android/bluetooth/BluetoothPbap.java b/core/java/android/bluetooth/BluetoothPbap.java
index 639ae1a..7de2ef6 100644..100755
--- a/core/java/android/bluetooth/BluetoothPbap.java
+++ b/core/java/android/bluetooth/BluetoothPbap.java
@@ -70,6 +70,7 @@ public class BluetoothPbap {
private IBluetoothPbap mService;
private final Context mContext;
private ServiceListener mServiceListener;
+ private BluetoothAdapter mAdapter;
/** There was an error trying to obtain the state */
public static final int STATE_ERROR = -1;
@@ -96,7 +97,7 @@ public class BluetoothPbap {
* this callback before making IPC calls on the BluetoothPbap
* service.
*/
- public void onServiceConnected();
+ public void onServiceConnected(BluetoothPbap proxy);
/**
* Called to notify the client that this proxy object has been
@@ -108,12 +109,54 @@ public class BluetoothPbap {
public void onServiceDisconnected();
}
+ final private IBluetoothStateChangeCallback mBluetoothStateChangeCallback =
+ new IBluetoothStateChangeCallback.Stub() {
+ public void onBluetoothStateChange(boolean up) {
+ if (DBG) Log.d(TAG, "onBluetoothStateChange: up=" + up);
+ if (!up) {
+ if (DBG) Log.d(TAG,"Unbinding service...");
+ synchronized (mConnection) {
+ try {
+ mService = null;
+ mContext.unbindService(mConnection);
+ } catch (Exception re) {
+ Log.e(TAG,"",re);
+ }
+ }
+ } else {
+ synchronized (mConnection) {
+ try {
+ if (mService == null) {
+ if (DBG) Log.d(TAG,"Binding service...");
+ if (!mContext.bindService(
+ new Intent(IBluetoothPbap.class.getName()),
+ mConnection, 0)) {
+ Log.e(TAG, "Could not bind to Bluetooth PBAP Service");
+ }
+ }
+ } catch (Exception re) {
+ Log.e(TAG,"",re);
+ }
+ }
+ }
+ }
+ };
+
/**
* Create a BluetoothPbap proxy object.
*/
public BluetoothPbap(Context context, ServiceListener l) {
mContext = context;
mServiceListener = l;
+ mAdapter = BluetoothAdapter.getDefaultAdapter();
+ IBluetoothManager mgr = mAdapter.getBluetoothManager();
+ if (mgr != null) {
+ try {
+ mgr.registerStateChangeCallback(mBluetoothStateChangeCallback);
+ } catch (RemoteException e) {
+ Log.e(TAG,"",e);
+ }
+ }
if (!context.bindService(new Intent(IBluetoothPbap.class.getName()), mConnection, 0)) {
Log.e(TAG, "Could not bind to Bluetooth Pbap Service");
}
@@ -134,9 +177,25 @@ public class BluetoothPbap {
* are ok.
*/
public synchronized void close() {
- if (mConnection != null) {
- mContext.unbindService(mConnection);
- mConnection = null;
+ IBluetoothManager mgr = mAdapter.getBluetoothManager();
+ if (mgr != null) {
+ try {
+ mgr.unregisterStateChangeCallback(mBluetoothStateChangeCallback);
+ } catch (Exception e) {
+ Log.e(TAG,"",e);
+ }
+ }
+
+ synchronized (mConnection) {
+ if (mService != null) {
+ try {
+ mService = null;
+ mContext.unbindService(mConnection);
+ mConnection = null;
+ } catch (Exception re) {
+ Log.e(TAG,"",re);
+ }
+ }
}
mServiceListener = null;
}
@@ -240,7 +299,7 @@ public class BluetoothPbap {
if (DBG) log("Proxy object connected");
mService = IBluetoothPbap.Stub.asInterface(service);
if (mServiceListener != null) {
- mServiceListener.onServiceConnected();
+ mServiceListener.onServiceConnected(BluetoothPbap.this);
}
}
public void onServiceDisconnected(ComponentName className) {
diff --git a/core/java/android/bluetooth/BluetoothProfile.java b/core/java/android/bluetooth/BluetoothProfile.java
index eada27c..1920efa 100755
--- a/core/java/android/bluetooth/BluetoothProfile.java
+++ b/core/java/android/bluetooth/BluetoothProfile.java
@@ -115,13 +115,6 @@ public interface BluetoothProfile {
public static final int PRIORITY_UNDEFINED = -1;
/**
- * This Intent is sent to initiate the other profile connections which are enabled
- * @hide
- **/
- public static final String ACTION_CONNECT_OTHER_PROFILES =
- "android.bluetooth.profile.CONNECT_OTHER_PROFILES";
-
- /**
* Get connected devices for this specific profile.
*
* <p> Return the set of devices which are in state {@link #STATE_CONNECTED}
diff --git a/core/java/android/inputmethodservice/IInputMethodSessionWrapper.java b/core/java/android/inputmethodservice/IInputMethodSessionWrapper.java
index e10f218..ce797d1 100644
--- a/core/java/android/inputmethodservice/IInputMethodSessionWrapper.java
+++ b/core/java/android/inputmethodservice/IInputMethodSessionWrapper.java
@@ -17,6 +17,7 @@
package android.inputmethodservice;
import com.android.internal.os.HandlerCaller;
+import com.android.internal.os.SomeArgs;
import com.android.internal.view.IInputMethodCallback;
import com.android.internal.view.IInputMethodSession;
@@ -91,28 +92,28 @@ class IInputMethodSessionWrapper extends IInputMethodSession.Stub
(ExtractedText)msg.obj);
return;
case DO_DISPATCH_KEY_EVENT: {
- HandlerCaller.SomeArgs args = (HandlerCaller.SomeArgs)msg.obj;
+ SomeArgs args = (SomeArgs)msg.obj;
mInputMethodSession.dispatchKeyEvent(msg.arg1,
(KeyEvent)args.arg1,
new InputMethodEventCallbackWrapper(
(IInputMethodCallback)args.arg2));
- mCaller.recycleArgs(args);
+ args.recycle();
return;
}
case DO_DISPATCH_TRACKBALL_EVENT: {
- HandlerCaller.SomeArgs args = (HandlerCaller.SomeArgs)msg.obj;
+ SomeArgs args = (SomeArgs)msg.obj;
mInputMethodSession.dispatchTrackballEvent(msg.arg1,
(MotionEvent)args.arg1,
new InputMethodEventCallbackWrapper(
(IInputMethodCallback)args.arg2));
- mCaller.recycleArgs(args);
+ args.recycle();
return;
}
case DO_UPDATE_SELECTION: {
- HandlerCaller.SomeArgs args = (HandlerCaller.SomeArgs)msg.obj;
+ SomeArgs args = (SomeArgs)msg.obj;
mInputMethodSession.updateSelection(args.argi1, args.argi2,
args.argi3, args.argi4, args.argi5, args.argi6);
- mCaller.recycleArgs(args);
+ args.recycle();
return;
}
case DO_UPDATE_CURSOR: {
@@ -120,10 +121,10 @@ class IInputMethodSessionWrapper extends IInputMethodSession.Stub
return;
}
case DO_APP_PRIVATE_COMMAND: {
- HandlerCaller.SomeArgs args = (HandlerCaller.SomeArgs)msg.obj;
+ SomeArgs args = (SomeArgs)msg.obj;
mInputMethodSession.appPrivateCommand((String)args.arg1,
(Bundle)args.arg2);
- mCaller.recycleArgs(args);
+ args.recycle();
return;
}
case DO_TOGGLE_SOFT_INPUT: {
diff --git a/core/java/android/inputmethodservice/IInputMethodWrapper.java b/core/java/android/inputmethodservice/IInputMethodWrapper.java
index 17c9ee7..5275314 100644
--- a/core/java/android/inputmethodservice/IInputMethodWrapper.java
+++ b/core/java/android/inputmethodservice/IInputMethodWrapper.java
@@ -17,6 +17,7 @@
package android.inputmethodservice;
import com.android.internal.os.HandlerCaller;
+import com.android.internal.os.SomeArgs;
import com.android.internal.view.IInputContext;
import com.android.internal.view.IInputMethod;
import com.android.internal.view.IInputMethodCallback;
@@ -124,7 +125,7 @@ class IInputMethodWrapper extends IInputMethod.Stub
if (target == null) {
return;
}
- HandlerCaller.SomeArgs args = (HandlerCaller.SomeArgs)msg.obj;
+ SomeArgs args = (SomeArgs)msg.obj;
try {
target.dump((FileDescriptor)args.arg1,
(PrintWriter)args.arg2, (String[])args.arg3);
@@ -134,6 +135,7 @@ class IInputMethodWrapper extends IInputMethod.Stub
synchronized (args.arg4) {
((CountDownLatch)args.arg4).countDown();
}
+ args.recycle();
return;
}
@@ -149,23 +151,25 @@ class IInputMethodWrapper extends IInputMethod.Stub
inputMethod.unbindInput();
return;
case DO_START_INPUT: {
- HandlerCaller.SomeArgs args = (HandlerCaller.SomeArgs)msg.obj;
+ SomeArgs args = (SomeArgs)msg.obj;
IInputContext inputContext = (IInputContext)args.arg1;
InputConnection ic = inputContext != null
? new InputConnectionWrapper(inputContext) : null;
EditorInfo info = (EditorInfo)args.arg2;
info.makeCompatible(mTargetSdkVersion);
inputMethod.startInput(ic, info);
+ args.recycle();
return;
}
case DO_RESTART_INPUT: {
- HandlerCaller.SomeArgs args = (HandlerCaller.SomeArgs)msg.obj;
+ SomeArgs args = (SomeArgs)msg.obj;
IInputContext inputContext = (IInputContext)args.arg1;
InputConnection ic = inputContext != null
? new InputConnectionWrapper(inputContext) : null;
EditorInfo info = (EditorInfo)args.arg2;
info.makeCompatible(mTargetSdkVersion);
inputMethod.restartInput(ic, info);
+ args.recycle();
return;
}
case DO_CREATE_SESSION: {
diff --git a/core/java/android/os/Binder.java b/core/java/android/os/Binder.java
index 577fc43..7b51119 100644
--- a/core/java/android/os/Binder.java
+++ b/core/java/android/os/Binder.java
@@ -32,7 +32,7 @@ import java.lang.reflect.Modifier;
* the standard support creating a local implementation of such an object.
*
* <p>Most developers will not implement this class directly, instead using the
- * <a href="{@docRoot}guide/developing/tools/aidl.html">aidl</a> tool to describe the desired
+ * <a href="{@docRoot}guide/components/aidl.html">aidl</a> tool to describe the desired
* interface, having it generate the appropriate Binder subclass. You can,
* however, derive directly from Binder to implement your own custom RPC
* protocol or simply instantiate a raw Binder object directly to use as a
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index c8bb886..e1ef67c 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -2585,6 +2585,13 @@ public final class Settings {
public static final String DEVELOPMENT_SETTINGS_ENABLED = "development_settings_enabled";
/**
+ * When the user has enable the option to have a "bug report" command
+ * in the power menu.
+ * @hide
+ */
+ public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu";
+
+ /**
* Whether ADB is enabled.
*/
public static final String ADB_ENABLED = "adb_enabled";
@@ -4316,6 +4323,7 @@ public final class Settings {
*/
public static final String[] SETTINGS_TO_BACKUP = {
ADB_ENABLED,
+ BUGREPORT_IN_POWER_MENU,
ALLOW_MOCK_LOCATION,
PARENTAL_CONTROL_ENABLED,
PARENTAL_CONTROL_REDIRECT_URL,
diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java
index 6f45ca7..b513915 100644
--- a/core/java/android/service/wallpaper/WallpaperService.java
+++ b/core/java/android/service/wallpaper/WallpaperService.java
@@ -255,7 +255,7 @@ public abstract class WallpaperService extends Service {
final BaseIWindow mWindow = new BaseIWindow() {
@Override
- public void resized(int w, int h, Rect contentInsets,
+ public void resized(Rect frame, Rect contentInsets,
Rect visibleInsets, boolean reportDraw, Configuration newConfig) {
Message msg = mCaller.obtainMessageI(MSG_WINDOW_RESIZED,
reportDraw ? 1 : 0);
diff --git a/core/java/android/test/AndroidTestCase.java b/core/java/android/test/AndroidTestCase.java
index 1015506..0c8cbe6 100644
--- a/core/java/android/test/AndroidTestCase.java
+++ b/core/java/android/test/AndroidTestCase.java
@@ -135,7 +135,8 @@ public class AndroidTestCase extends TestCase {
fail("expected SecurityException requiring " + permission);
} catch (SecurityException expected) {
assertNotNull("security exception's error message.", expected.getMessage());
- assertTrue("error message should contain " + permission + ".",
+ assertTrue("error message should contain \"" + permission + "\". Got: \""
+ + expected.getMessage() + "\".",
expected.getMessage().contains(permission));
}
}
diff --git a/core/java/android/view/AccessibilityInteractionController.java b/core/java/android/view/AccessibilityInteractionController.java
index fbda474..9bee4bf 100644
--- a/core/java/android/view/AccessibilityInteractionController.java
+++ b/core/java/android/view/AccessibilityInteractionController.java
@@ -25,16 +25,14 @@ import android.os.Looper;
import android.os.Message;
import android.os.Process;
import android.os.RemoteException;
-import android.util.Pool;
-import android.util.Poolable;
-import android.util.PoolableManager;
-import android.util.Pools;
import android.util.SparseLongArray;
import android.view.accessibility.AccessibilityInteractionClient;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.accessibility.AccessibilityNodeProvider;
import android.view.accessibility.IAccessibilityInteractionConnectionCallback;
+import com.android.internal.os.SomeArgs;
+
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -48,7 +46,6 @@ import java.util.Map;
* UI thread.
*/
final class AccessibilityInteractionController {
- private static final int POOL_SIZE = 5;
private ArrayList<AccessibilityNodeInfo> mTempAccessibilityNodeInfoList =
new ArrayList<AccessibilityNodeInfo>();
@@ -76,60 +73,6 @@ final class AccessibilityInteractionController {
mPrefetcher = new AccessibilityNodePrefetcher();
}
- // Reusable poolable arguments for interacting with the view hierarchy
- // to fit more arguments than Message and to avoid sharing objects between
- // two messages since several threads can send messages concurrently.
- private final Pool<SomeArgs> mPool = Pools.synchronizedPool(Pools.finitePool(
- new PoolableManager<SomeArgs>() {
- public SomeArgs newInstance() {
- return new SomeArgs();
- }
-
- public void onAcquired(SomeArgs info) {
- /* do nothing */
- }
-
- public void onReleased(SomeArgs info) {
- info.clear();
- }
- }, POOL_SIZE)
- );
-
- private class SomeArgs implements Poolable<SomeArgs> {
- private SomeArgs mNext;
- private boolean mIsPooled;
-
- public Object arg1;
- public Object arg2;
- public int argi1;
- public int argi2;
- public int argi3;
-
- public SomeArgs getNextPoolable() {
- return mNext;
- }
-
- public boolean isPooled() {
- return mIsPooled;
- }
-
- public void setNextPoolable(SomeArgs args) {
- mNext = args;
- }
-
- public void setPooled(boolean isPooled) {
- mIsPooled = isPooled;
- }
-
- private void clear() {
- arg1 = null;
- arg2 = null;
- argi1 = 0;
- argi2 = 0;
- argi3 = 0;
- }
- }
-
private boolean isShown(View view) {
// The first two checks are made also made by isShown() which
// however traverses the tree up to the parent to catch that.
@@ -148,7 +91,7 @@ final class AccessibilityInteractionController {
message.what = PrivateHandler.MSG_FIND_ACCESSIBLITY_NODE_INFO_BY_ACCESSIBILITY_ID;
message.arg1 = flags;
- SomeArgs args = mPool.acquire();
+ SomeArgs args = SomeArgs.obtain();
args.argi1 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId);
args.argi2 = AccessibilityNodeInfo.getVirtualDescendantId(accessibilityNodeId);
args.argi3 = interactionId;
@@ -177,7 +120,7 @@ final class AccessibilityInteractionController {
final IAccessibilityInteractionConnectionCallback callback =
(IAccessibilityInteractionConnectionCallback) args.arg1;
- mPool.release(args);
+ args.recycle();
List<AccessibilityNodeInfo> infos = mTempAccessibilityNodeInfoList;
infos.clear();
@@ -216,7 +159,7 @@ final class AccessibilityInteractionController {
message.arg1 = flags;
message.arg2 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId);
- SomeArgs args = mPool.acquire();
+ SomeArgs args = SomeArgs.obtain();
args.argi1 = viewId;
args.argi2 = interactionId;
args.arg1 = callback;
@@ -245,7 +188,7 @@ final class AccessibilityInteractionController {
final IAccessibilityInteractionConnectionCallback callback =
(IAccessibilityInteractionConnectionCallback) args.arg1;
- mPool.release(args);
+ args.recycle();
AccessibilityNodeInfo info = null;
try {
@@ -284,7 +227,7 @@ final class AccessibilityInteractionController {
message.what = PrivateHandler.MSG_FIND_ACCESSIBLITY_NODE_INFO_BY_TEXT;
message.arg1 = flags;
- SomeArgs args = mPool.acquire();
+ SomeArgs args = SomeArgs.obtain();
args.arg1 = text;
args.arg2 = callback;
args.argi1 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId);
@@ -315,7 +258,7 @@ final class AccessibilityInteractionController {
final int accessibilityViewId = args.argi1;
final int virtualDescendantId = args.argi2;
final int interactionId = args.argi3;
- mPool.release(args);
+ args.recycle();
List<AccessibilityNodeInfo> infos = null;
try {
@@ -383,7 +326,7 @@ final class AccessibilityInteractionController {
message.arg1 = flags;
message.arg2 = focusType;
- SomeArgs args = mPool.acquire();
+ SomeArgs args = SomeArgs.obtain();
args.argi1 = interactionId;
args.argi2 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId);
args.argi3 = AccessibilityNodeInfo.getVirtualDescendantId(accessibilityNodeId);
@@ -414,7 +357,7 @@ final class AccessibilityInteractionController {
final IAccessibilityInteractionConnectionCallback callback =
(IAccessibilityInteractionConnectionCallback) args.arg1;
- mPool.release(args);
+ args.recycle();
AccessibilityNodeInfo focused = null;
try {
@@ -480,8 +423,7 @@ final class AccessibilityInteractionController {
message.arg1 = flags;
message.arg2 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId);
- SomeArgs args = mPool.acquire();
- args.argi1 = AccessibilityNodeInfo.getVirtualDescendantId(accessibilityNodeId);
+ SomeArgs args = SomeArgs.obtain();
args.argi2 = direction;
args.argi3 = interactionId;
args.arg1 = callback;
@@ -505,13 +447,12 @@ final class AccessibilityInteractionController {
final int accessibilityViewId = message.arg2;
SomeArgs args = (SomeArgs) message.obj;
- final int virtualDescendantId = args.argi1;
final int direction = args.argi2;
final int interactionId = args.argi3;
final IAccessibilityInteractionConnectionCallback callback =
(IAccessibilityInteractionConnectionCallback) args.arg1;
- mPool.release(args);
+ args.recycle();
AccessibilityNodeInfo next = null;
try {
@@ -552,7 +493,7 @@ final class AccessibilityInteractionController {
message.arg1 = flags;
message.arg2 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId);
- SomeArgs args = mPool.acquire();
+ SomeArgs args = SomeArgs.obtain();
args.argi1 = AccessibilityNodeInfo.getVirtualDescendantId(accessibilityNodeId);
args.argi2 = action;
args.argi3 = interactionId;
@@ -585,7 +526,7 @@ final class AccessibilityInteractionController {
(IAccessibilityInteractionConnectionCallback) args.arg1;
Bundle arguments = (Bundle) args.arg2;
- mPool.release(args);
+ args.recycle();
boolean succeeded = false;
try {
diff --git a/core/java/android/view/GLES20RenderLayer.java b/core/java/android/view/GLES20RenderLayer.java
index a77425a..b5cfc11 100644
--- a/core/java/android/view/GLES20RenderLayer.java
+++ b/core/java/android/view/GLES20RenderLayer.java
@@ -82,17 +82,11 @@ class GLES20RenderLayer extends GLES20Layer {
}
@Override
- void end(Canvas currentCanvas) {
- if (currentCanvas instanceof GLES20Canvas) {
- ((GLES20Canvas) currentCanvas).resume();
- }
+ void end() {
}
@Override
- HardwareCanvas start(Canvas currentCanvas) {
- if (currentCanvas instanceof GLES20Canvas) {
- ((GLES20Canvas) currentCanvas).interrupt();
- }
+ HardwareCanvas start() {
return getCanvas();
}
diff --git a/core/java/android/view/GLES20TextureLayer.java b/core/java/android/view/GLES20TextureLayer.java
index e198ef6..6ad36ef 100644
--- a/core/java/android/view/GLES20TextureLayer.java
+++ b/core/java/android/view/GLES20TextureLayer.java
@@ -16,7 +16,6 @@
package android.view;
-import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.graphics.SurfaceTexture;
@@ -57,12 +56,12 @@ class GLES20TextureLayer extends GLES20Layer {
}
@Override
- HardwareCanvas start(Canvas currentCanvas) {
+ HardwareCanvas start() {
return null;
}
@Override
- void end(Canvas currentCanvas) {
+ void end() {
}
SurfaceTexture getSurfaceTexture() {
diff --git a/core/java/android/view/HardwareLayer.java b/core/java/android/view/HardwareLayer.java
index 06c6e7c..8fdf104 100644
--- a/core/java/android/view/HardwareLayer.java
+++ b/core/java/android/view/HardwareLayer.java
@@ -17,7 +17,6 @@
package android.view;
import android.graphics.Bitmap;
-import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Rect;
@@ -144,15 +143,13 @@ abstract class HardwareLayer {
/**
* This must be invoked before drawing onto this layer.
- * @param currentCanvas
*/
- abstract HardwareCanvas start(Canvas currentCanvas);
+ abstract HardwareCanvas start();
/**
* This must be invoked after drawing onto this layer.
- * @param currentCanvas
*/
- abstract void end(Canvas currentCanvas);
+ abstract void end();
/**
* Copies this layer into the specified bitmap.
diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java
index 8236cd7..188fede 100644
--- a/core/java/android/view/HardwareRenderer.java
+++ b/core/java/android/view/HardwareRenderer.java
@@ -135,7 +135,19 @@ public abstract class HardwareRenderer {
* @hide
*/
public static final String DEBUG_DIRTY_REGIONS_PROPERTY = "debug.hwui.show_dirty_regions";
-
+
+ /**
+ * Turn on to flash hardware layers when they update.
+ *
+ * Possible values:
+ * "true", to enable hardware layers updates debugging
+ * "false", to disable hardware layers updates debugging
+ *
+ * @hide
+ */
+ public static final String DEBUG_SHOW_LAYERS_UPDATES_PROPERTY =
+ "debug.hwui.show_layers_updates";
+
/**
* A process can set this flag to false to prevent the use of hardware
* rendering.
diff --git a/core/java/android/view/IWindow.aidl b/core/java/android/view/IWindow.aidl
index 9f22870..15bd46c 100644
--- a/core/java/android/view/IWindow.aidl
+++ b/core/java/android/view/IWindow.aidl
@@ -45,7 +45,7 @@ oneway interface IWindow {
*/
void executeCommand(String command, String parameters, in ParcelFileDescriptor descriptor);
- void resized(int w, int h, in Rect contentInsets,
+ void resized(in Rect frame, in Rect contentInsets,
in Rect visibleInsets, boolean reportDraw, in Configuration newConfig);
void moved(int newX, int newY);
void dispatchAppVisibility(boolean visible);
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index cd35002..59aeffc 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -2076,6 +2076,15 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
*/
static final int VIEW_QUICK_REJECTED = 0x10000000;
+ /**
+ * Flag indicating that start/end padding has been resolved into left/right padding
+ * for use in measurement, layout, drawing, etc. This is set by {@link #resolvePadding()}
+ * and checked by {@link #measure(int, int)} to determine if padding needs to be resolved
+ * during measurement. In some special cases this is required such as when an adapter-based
+ * view measures prospective children without attaching them to a window.
+ */
+ static final int PADDING_RESOLVED = 0x20000000;
+
// There are a couple of flags left in mPrivateFlags2
/* End of masks for mPrivateFlags2 */
@@ -11335,6 +11344,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
internalSetPadding(mUserPaddingLeft, mPaddingTop, mUserPaddingRight, mUserPaddingBottom);
onPaddingChanged(resolvedLayoutDirection);
+ mPrivateFlags2 |= PADDING_RESOLVED;
}
/**
@@ -11430,6 +11440,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
resetResolvedLayoutDirection();
resetResolvedTextAlignment();
resetAccessibilityStateChanged();
+ mPrivateFlags2 &= ~PADDING_RESOLVED;
}
/**
@@ -14107,7 +14118,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
internalSetPadding(left, top, right, bottom);
}
- private void internalSetPadding(int left, int top, int right, int bottom) {
+ void internalSetPadding(int left, int top, int right, int bottom) {
mUserPaddingLeft = left;
mUserPaddingRight = right;
mUserPaddingBottom = bottom;
@@ -14949,6 +14960,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
// first clears the measured dimension flag
mPrivateFlags &= ~MEASURED_DIMENSION_SET;
+ if ((mPrivateFlags2 & PADDING_RESOLVED) == 0) {
+ resolvePadding();
+ }
+
// measure ourselves, this should set the measured dimension flag back
onMeasure(widthMeasureSpec, heightMeasureSpec);
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 95eed33..1548743 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -170,6 +170,14 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
* This field should be made private, so it is hidden from the SDK.
* {@hide}
*/
+ @ViewDebug.ExportedProperty(flagMapping = {
+ @ViewDebug.FlagToString(mask = FLAG_CLIP_CHILDREN, equals = FLAG_CLIP_CHILDREN,
+ name = "CLIP_CHILDREN"),
+ @ViewDebug.FlagToString(mask = FLAG_CLIP_TO_PADDING, equals = FLAG_CLIP_TO_PADDING,
+ name = "CLIP_TO_PADDING"),
+ @ViewDebug.FlagToString(mask = FLAG_PADDING_NOT_NULL, equals = FLAG_PADDING_NOT_NULL,
+ name = "PADDING_NOT_NULL")
+ })
protected int mGroupFlags;
/*
@@ -2509,12 +2517,9 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
super.dispatchDetachedFromWindow();
}
- /**
- * {@inheritDoc}
- */
@Override
- public void setPadding(int left, int top, int right, int bottom) {
- super.setPadding(left, top, right, bottom);
+ void internalSetPadding(int left, int top, int right, int bottom) {
+ super.internalSetPadding(left, top, right, bottom);
if ((mPaddingLeft | mPaddingTop | mPaddingRight | mPaddingBottom) != 0) {
mGroupFlags |= FLAG_PADDING_NOT_NULL;
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 1ad42f5..3993432 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -74,6 +74,7 @@ import android.view.inputmethod.InputMethodManager;
import android.widget.Scroller;
import com.android.internal.R;
+import com.android.internal.os.SomeArgs;
import com.android.internal.policy.PolicyManager;
import com.android.internal.view.BaseSurfaceHolder;
import com.android.internal.view.RootViewSurfaceTaker;
@@ -109,7 +110,7 @@ public final class ViewRootImpl implements ViewParent,
private static final boolean DEBUG_FPS = false;
private static final boolean USE_RENDER_THREAD = false;
-
+
/**
* Set this system property to true to force the view hierarchy to render
* at 60 Hz. This can be used to measure the potential framerate.
@@ -264,12 +265,6 @@ public final class ViewRootImpl implements ViewParent,
final Configuration mLastConfiguration = new Configuration();
final Configuration mPendingConfiguration = new Configuration();
- class ResizedInfo {
- Rect contentInsets;
- Rect visibleInsets;
- Configuration newConfig;
- }
-
boolean mScrollMayChange;
int mSoftInputMode;
View mLastScrolledFocus;
@@ -1413,7 +1408,6 @@ public final class ViewRootImpl implements ViewParent,
disposeResizeBuffer();
boolean completed = false;
- HardwareCanvas hwRendererCanvas = mAttachInfo.mHardwareRenderer.getCanvas();
HardwareCanvas layerCanvas = null;
try {
if (mResizeBuffer == null) {
@@ -1423,7 +1417,7 @@ public final class ViewRootImpl implements ViewParent,
mResizeBuffer.getHeight() != mHeight) {
mResizeBuffer.resize(mWidth, mHeight);
}
- layerCanvas = mResizeBuffer.start(hwRendererCanvas);
+ layerCanvas = mResizeBuffer.start();
layerCanvas.setViewport(mWidth, mHeight);
layerCanvas.onPreDraw(null);
final int restoreCount = layerCanvas.save();
@@ -1462,7 +1456,7 @@ public final class ViewRootImpl implements ViewParent,
layerCanvas.onPostDraw();
}
if (mResizeBuffer != null) {
- mResizeBuffer.end(hwRendererCanvas);
+ mResizeBuffer.end();
if (!completed) {
mResizeBuffer.destroy();
mResizeBuffer = null;
@@ -2823,29 +2817,31 @@ public final class ViewRootImpl implements ViewParent,
case MSG_DISPATCH_GET_NEW_SURFACE:
handleGetNewSurface();
break;
- case MSG_RESIZED:
- ResizedInfo ri = (ResizedInfo)msg.obj;
-
- if (mWinFrame.width() == msg.arg1 && mWinFrame.height() == msg.arg2
- && mPendingContentInsets.equals(ri.contentInsets)
- && mPendingVisibleInsets.equals(ri.visibleInsets)
- && ((ResizedInfo)msg.obj).newConfig == null) {
+ case MSG_RESIZED: {
+ // Recycled in the fall through...
+ SomeArgs args = (SomeArgs) msg.obj;
+ if (mWinFrame.equals((Rect) args.arg1)
+ && mPendingContentInsets.equals((Rect) args.arg2)
+ && mPendingVisibleInsets.equals((Rect) args.arg3)
+ && ((Configuration) args.arg4 == null)) {
break;
}
- // fall through...
+ } // fall through...
case MSG_RESIZED_REPORT:
if (mAdded) {
- Configuration config = ((ResizedInfo)msg.obj).newConfig;
+ SomeArgs args = (SomeArgs) msg.obj;
+
+ Configuration config = (Configuration) args.arg4;
if (config != null) {
updateConfiguration(config, false);
}
- // TODO: Should left/top stay unchanged and only change the right/bottom?
- mWinFrame.left = 0;
- mWinFrame.right = msg.arg1;
- mWinFrame.top = 0;
- mWinFrame.bottom = msg.arg2;
- mPendingContentInsets.set(((ResizedInfo)msg.obj).contentInsets);
- mPendingVisibleInsets.set(((ResizedInfo)msg.obj).visibleInsets);
+
+ mWinFrame.set((Rect) args.arg1);
+ mPendingContentInsets.set((Rect) args.arg2);
+ mPendingVisibleInsets.set((Rect) args.arg3);
+
+ args.recycle();
+
if (msg.what == MSG_RESIZED_REPORT) {
mReportNextDraw = true;
}
@@ -2853,6 +2849,7 @@ public final class ViewRootImpl implements ViewParent,
if (mView != null) {
forceLayout(mView);
}
+
requestLayout();
}
break;
@@ -4069,26 +4066,25 @@ public final class ViewRootImpl implements ViewParent,
mHandler.sendMessage(msg);
}
- public void dispatchResized(int w, int h, Rect contentInsets,
+ public void dispatchResized(Rect frame, Rect contentInsets,
Rect visibleInsets, boolean reportDraw, Configuration newConfig) {
- if (DEBUG_LAYOUT) Log.v(TAG, "Resizing " + this + ": w=" + w
- + " h=" + h + " contentInsets=" + contentInsets.toShortString()
+ if (DEBUG_LAYOUT) Log.v(TAG, "Resizing " + this + ": frame=" + frame.toShortString()
+ + " contentInsets=" + contentInsets.toShortString()
+ " visibleInsets=" + visibleInsets.toShortString()
+ " reportDraw=" + reportDraw);
- Message msg = mHandler.obtainMessage(reportDraw ? MSG_RESIZED_REPORT :MSG_RESIZED);
+ Message msg = mHandler.obtainMessage(reportDraw ? MSG_RESIZED_REPORT : MSG_RESIZED);
if (mTranslator != null) {
+ mTranslator.translateRectInScreenToAppWindow(frame);
mTranslator.translateRectInScreenToAppWindow(contentInsets);
mTranslator.translateRectInScreenToAppWindow(visibleInsets);
- w *= mTranslator.applicationInvertedScale;
- h *= mTranslator.applicationInvertedScale;
- }
- msg.arg1 = w;
- msg.arg2 = h;
- ResizedInfo ri = new ResizedInfo();
- ri.contentInsets = new Rect(contentInsets);
- ri.visibleInsets = new Rect(visibleInsets);
- ri.newConfig = newConfig;
- msg.obj = ri;
+ }
+ SomeArgs args = SomeArgs.obtain();
+ final boolean sameProcessCall = (Binder.getCallingPid() == android.os.Process.myPid());
+ args.arg1 = sameProcessCall ? new Rect(frame) : frame;
+ args.arg2 = sameProcessCall ? new Rect(contentInsets) : contentInsets;
+ args.arg3 = sameProcessCall ? new Rect(visibleInsets) : visibleInsets;
+ args.arg4 = sameProcessCall && newConfig != null ? new Configuration(newConfig) : newConfig;
+ msg.obj = args;
mHandler.sendMessage(msg);
}
@@ -4734,11 +4730,11 @@ public final class ViewRootImpl implements ViewParent,
mViewAncestor = new WeakReference<ViewRootImpl>(viewAncestor);
}
- public void resized(int w, int h, Rect contentInsets,
+ public void resized(Rect frame, Rect contentInsets,
Rect visibleInsets, boolean reportDraw, Configuration newConfig) {
final ViewRootImpl viewAncestor = mViewAncestor.get();
if (viewAncestor != null) {
- viewAncestor.dispatchResized(w, h, contentInsets,
+ viewAncestor.dispatchResized(frame, contentInsets,
visibleInsets, reportDraw, newConfig);
}
}
diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java
index 58f0b85..548d4ad 100644
--- a/core/java/android/view/inputmethod/InputMethodManager.java
+++ b/core/java/android/view/inputmethod/InputMethodManager.java
@@ -16,7 +16,7 @@
package android.view.inputmethod;
-import com.android.internal.os.HandlerCaller;
+import com.android.internal.os.SomeArgs;
import com.android.internal.view.IInputConnectionWrapper;
import com.android.internal.view.IInputContext;
import com.android.internal.view.IInputMethodCallback;
@@ -341,7 +341,7 @@ public final class InputMethodManager {
public void handleMessage(Message msg) {
switch (msg.what) {
case MSG_DUMP: {
- HandlerCaller.SomeArgs args = (HandlerCaller.SomeArgs)msg.obj;
+ SomeArgs args = (SomeArgs)msg.obj;
try {
doDump((FileDescriptor)args.arg1,
(PrintWriter)args.arg2, (String[])args.arg3);
@@ -351,6 +351,7 @@ public final class InputMethodManager {
synchronized (args.arg4) {
((CountDownLatch)args.arg4).countDown();
}
+ args.recycle();
return;
}
case MSG_BIND: {
@@ -486,7 +487,7 @@ public final class InputMethodManager {
// interface to the system.
CountDownLatch latch = new CountDownLatch(1);
- HandlerCaller.SomeArgs sargs = new HandlerCaller.SomeArgs();
+ SomeArgs sargs = SomeArgs.obtain();
sargs.arg1 = fd;
sargs.arg2 = fout;
sargs.arg3 = args;
diff --git a/core/java/com/android/internal/os/HandlerCaller.java b/core/java/com/android/internal/os/HandlerCaller.java
index a94fb1e..84699dc 100644
--- a/core/java/com/android/internal/os/HandlerCaller.java
+++ b/core/java/com/android/internal/os/HandlerCaller.java
@@ -22,35 +22,14 @@ import android.os.Looper;
import android.os.Message;
public class HandlerCaller {
- private static final String TAG = "HandlerCaller";
- private static final boolean DEBUG = false;
-
+
public final Context mContext;
final Looper mMainLooper;
final Handler mH;
final Callback mCallback;
-
- public static class SomeArgs {
- SomeArgs next;
-
- public Object arg1;
- public Object arg2;
- public Object arg3;
- public Object arg4;
- public int argi1;
- public int argi2;
- public int argi3;
- public int argi4;
- public int argi5;
- public int argi6;
- }
-
- static final int ARGS_POOL_MAX_SIZE = 10;
- int mArgsPoolSize;
- SomeArgs mArgsPool;
-
+
class MyHandler extends Handler {
MyHandler(Looper looper) {
super(looper);
@@ -80,29 +59,6 @@ public class HandlerCaller {
mCallback = callback;
}
- public SomeArgs obtainArgs() {
- synchronized (mH) {
- SomeArgs args = mArgsPool;
- if (args != null) {
- mArgsPool = args.next;
- args.next = null;
- mArgsPoolSize--;
- return args;
- }
- }
- return new SomeArgs();
- }
-
- public void recycleArgs(SomeArgs args) {
- synchronized (mH) {
- if (mArgsPoolSize < ARGS_POOL_MAX_SIZE) {
- args.next = mArgsPool;
- mArgsPool = args;
- mArgsPoolSize++;
- }
- }
- }
-
public void executeOrSendMessage(Message msg) {
// If we are calling this from the main thread, then we can call
// right through. Otherwise, we need to send the message to the
@@ -141,7 +97,7 @@ public class HandlerCaller {
}
public Message obtainMessageBOO(int what, boolean arg1, Object arg2, Object arg3) {
- SomeArgs args = obtainArgs();
+ SomeArgs args = SomeArgs.obtain();
args.arg1 = arg2;
args.arg2 = arg3;
return mH.obtainMessage(what, arg1 ? 1 : 0, 0, args);
@@ -169,28 +125,28 @@ public class HandlerCaller {
public Message obtainMessageIIOO(int what, int arg1, int arg2,
Object arg3, Object arg4) {
- SomeArgs args = obtainArgs();
+ SomeArgs args = SomeArgs.obtain();
args.arg1 = arg3;
args.arg2 = arg4;
return mH.obtainMessage(what, arg1, arg2, args);
}
public Message obtainMessageIOO(int what, int arg1, Object arg2, Object arg3) {
- SomeArgs args = obtainArgs();
+ SomeArgs args = SomeArgs.obtain();
args.arg1 = arg2;
args.arg2 = arg3;
return mH.obtainMessage(what, arg1, 0, args);
}
public Message obtainMessageOO(int what, Object arg1, Object arg2) {
- SomeArgs args = obtainArgs();
+ SomeArgs args = SomeArgs.obtain();
args.arg1 = arg1;
args.arg2 = arg2;
return mH.obtainMessage(what, 0, 0, args);
}
public Message obtainMessageOOO(int what, Object arg1, Object arg2, Object arg3) {
- SomeArgs args = obtainArgs();
+ SomeArgs args = SomeArgs.obtain();
args.arg1 = arg1;
args.arg2 = arg2;
args.arg3 = arg3;
@@ -199,7 +155,7 @@ public class HandlerCaller {
public Message obtainMessageOOOO(int what, Object arg1, Object arg2,
Object arg3, Object arg4) {
- SomeArgs args = obtainArgs();
+ SomeArgs args = SomeArgs.obtain();
args.arg1 = arg1;
args.arg2 = arg2;
args.arg3 = arg3;
@@ -209,7 +165,7 @@ public class HandlerCaller {
public Message obtainMessageIIII(int what, int arg1, int arg2,
int arg3, int arg4) {
- SomeArgs args = obtainArgs();
+ SomeArgs args = SomeArgs.obtain();
args.argi1 = arg1;
args.argi2 = arg2;
args.argi3 = arg3;
@@ -219,7 +175,7 @@ public class HandlerCaller {
public Message obtainMessageIIIIII(int what, int arg1, int arg2,
int arg3, int arg4, int arg5, int arg6) {
- SomeArgs args = obtainArgs();
+ SomeArgs args = SomeArgs.obtain();
args.argi1 = arg1;
args.argi2 = arg2;
args.argi3 = arg3;
@@ -231,7 +187,7 @@ public class HandlerCaller {
public Message obtainMessageIIIIO(int what, int arg1, int arg2,
int arg3, int arg4, Object arg5) {
- SomeArgs args = obtainArgs();
+ SomeArgs args = SomeArgs.obtain();
args.arg1 = arg5;
args.argi1 = arg1;
args.argi2 = arg2;
diff --git a/core/java/com/android/internal/os/SomeArgs.java b/core/java/com/android/internal/os/SomeArgs.java
new file mode 100644
index 0000000..88e58dc
--- /dev/null
+++ b/core/java/com/android/internal/os/SomeArgs.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.internal.os;
+
+/**
+ * Helper class for passing more arguments though a message
+ * and avoiding allocation of a custom class for wrapping the
+ * arguments. This class maintains a pool of instances and
+ * it is responsibility of the client to recycle and instance
+ * once it is no longer used.
+ */
+public final class SomeArgs {
+
+ private static final int MAX_POOL_SIZE = 10;
+
+ private static SomeArgs sPool;
+ private static int sPoolSize;
+ private static Object sPoolLock = new Object();
+
+ private SomeArgs mNext;
+
+ private boolean mInPool;
+
+ public Object arg1;
+ public Object arg2;
+ public Object arg3;
+ public Object arg4;
+ public int argi1;
+ public int argi2;
+ public int argi3;
+ public int argi4;
+ public int argi5;
+ public int argi6;
+
+ private SomeArgs() {
+ /* do nothing - reduce visibility */
+ }
+
+ public static SomeArgs obtain() {
+ synchronized (sPoolLock) {
+ if (sPoolSize > 0) {
+ SomeArgs args = sPool;
+ sPool = sPool.mNext;
+ args.mNext = null;
+ args.mInPool = false;
+ sPoolSize--;
+ return args;
+ } else {
+ return new SomeArgs();
+ }
+ }
+ }
+
+ public void recycle() {
+ if (mInPool) {
+ throw new IllegalStateException("Already recycled.");
+ }
+ synchronized (sPoolLock) {
+ clear();
+ if (sPoolSize < MAX_POOL_SIZE) {
+ mNext = sPool;
+ mInPool = true;
+ sPool = this;
+ sPoolSize++;
+ }
+ }
+ }
+
+ private void clear() {
+ arg1 = null;
+ arg2 = null;
+ arg3 = null;
+ arg4 = null;
+ argi1 = 0;
+ argi2 = 0;
+ argi3 = 0;
+ argi4 = 0;
+ argi5 = 0;
+ argi6 = 0;
+ }
+}
diff --git a/core/java/com/android/internal/view/BaseIWindow.java b/core/java/com/android/internal/view/BaseIWindow.java
index ac1d594..b76e89d 100644
--- a/core/java/com/android/internal/view/BaseIWindow.java
+++ b/core/java/com/android/internal/view/BaseIWindow.java
@@ -34,7 +34,7 @@ public class BaseIWindow extends IWindow.Stub {
}
@Override
- public void resized(int w, int h, Rect contentInsets,
+ public void resized(Rect frame, Rect contentInsets,
Rect visibleInsets, boolean reportDraw, Configuration newConfig) {
if (reportDraw) {
try {
diff --git a/core/java/com/android/internal/widget/ActionBarView.java b/core/java/com/android/internal/widget/ActionBarView.java
index 8ff39d6..d6d2cf6 100644
--- a/core/java/com/android/internal/widget/ActionBarView.java
+++ b/core/java/com/android/internal/widget/ActionBarView.java
@@ -26,6 +26,7 @@ import com.android.internal.view.menu.MenuPresenter;
import com.android.internal.view.menu.MenuView;
import com.android.internal.view.menu.SubMenuBuilder;
+import android.animation.LayoutTransition;
import android.app.ActionBar;
import android.app.ActionBar.OnNavigationListener;
import android.app.Activity;
@@ -847,7 +848,7 @@ public class ActionBarView extends AbsActionBarView {
int contentWidth = MeasureSpec.getSize(widthMeasureSpec);
- int maxHeight = mContentHeight > 0 ?
+ int maxHeight = mContentHeight >= 0 ?
mContentHeight : MeasureSpec.getSize(heightMeasureSpec);
final int verticalPadding = getPaddingTop() + getPaddingBottom();
@@ -1271,12 +1272,19 @@ public class ActionBarView extends AbsActionBarView {
private ImageView mIconView;
private int mUpWidth;
+ private static final long DEFAULT_TRANSITION_DURATION = 150;
+
public HomeView(Context context) {
this(context, null);
}
public HomeView(Context context, AttributeSet attrs) {
super(context, attrs);
+ LayoutTransition t = getLayoutTransition();
+ if (t != null) {
+ // Set a lower duration than the default
+ t.setDuration(DEFAULT_TRANSITION_DURATION);
+ }
}
public void setUp(boolean isUp) {