Merge change I4db3a5b3 into eclair
* changes:
fix a javadoc build breakage
diff --git a/api/current.xml b/api/current.xml
index e764fa5..9b0ea3a 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -27787,6 +27787,28 @@
<parameter name="makeMap" type="boolean">
</parameter>
</method>
+<method name="isInitialStickyBroadcast"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="isOrderedBroadcast"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="onReceive"
return="void"
abstract="true"
diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java
index 0b4f25e..eca5af9 100644
--- a/cmds/am/src/com/android/commands/am/Am.java
+++ b/cmds/am/src/com/android/commands/am/Am.java
@@ -340,7 +340,8 @@
private boolean mFinished = false;
public synchronized void performReceive(
- Intent intent, int rc, String data, Bundle ext, boolean ord) {
+ Intent intent, int rc, String data, Bundle ext, boolean ord,
+ boolean sticky) {
String line = "Broadcast completed: result=" + rc;
if (data != null) line = line + ", data=\"" + data + "\"";
if (ext != null) line = line + ", extras: " + ext;
diff --git a/core/java/android/accounts/AccountAuthenticatorResponse.java b/core/java/android/accounts/AccountAuthenticatorResponse.java
index 3488c5e..7c09fbf 100644
--- a/core/java/android/accounts/AccountAuthenticatorResponse.java
+++ b/core/java/android/accounts/AccountAuthenticatorResponse.java
@@ -22,8 +22,7 @@
import android.os.RemoteException;
/**
- * Object that wraps calls to an {@link IAccountAuthenticatorResponse} object.
- * TODO: this interface is still in flux
+ * Object used to communicate responses back to the AccountManager
*/
public class AccountAuthenticatorResponse implements Parcelable {
private IAccountAuthenticatorResponse mAccountAuthenticatorResponse;
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index b4ac159..2cd223f 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -653,7 +653,7 @@
mStrongRef = strong ? rd : null;
}
public void performReceive(Intent intent, int resultCode,
- String data, Bundle extras, boolean ordered) {
+ String data, Bundle extras, boolean ordered, boolean sticky) {
ReceiverDispatcher rd = mDispatcher.get();
if (DEBUG_BROADCAST) {
int seq = intent.getIntExtra("seq", -1);
@@ -661,7 +661,8 @@
+ " to " + rd);
}
if (rd != null) {
- rd.performReceive(intent, resultCode, data, extras, ordered);
+ rd.performReceive(intent, resultCode, data, extras,
+ ordered, sticky);
}
}
}
@@ -681,6 +682,7 @@
private String mCurData;
private Bundle mCurMap;
private boolean mCurOrdered;
+ private boolean mCurSticky;
public void run() {
BroadcastReceiver receiver = mReceiver;
@@ -706,6 +708,7 @@
receiver.setResult(mCurCode, mCurData, mCurMap);
receiver.clearAbortBroadcast();
receiver.setOrderedHint(mCurOrdered);
+ receiver.setInitialStickyHint(mCurSticky);
receiver.onReceive(mContext, intent);
} catch (Exception e) {
if (mRegistered && mCurOrdered) {
@@ -788,7 +791,7 @@
}
public void performReceive(Intent intent, int resultCode,
- String data, Bundle extras, boolean ordered) {
+ String data, Bundle extras, boolean ordered, boolean sticky) {
if (DEBUG_BROADCAST) {
int seq = intent.getIntExtra("seq", -1);
Log.i(TAG, "Enqueueing broadcast " + intent.getAction() + " seq=" + seq
@@ -800,6 +803,7 @@
args.mCurData = data;
args.mCurMap = extras;
args.mCurOrdered = ordered;
+ args.mCurSticky = sticky;
if (!mActivityThread.post(args)) {
if (mRegistered) {
IActivityManager mgr = ActivityManagerNative.getDefault();
@@ -1515,9 +1519,9 @@
// correctly ordered, since these are one-way calls and the binder driver
// applies transaction ordering per object for such calls.
public void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent,
- int resultCode, String dataStr, Bundle extras, boolean ordered)
- throws RemoteException {
- receiver.performReceive(intent, resultCode, dataStr, extras, ordered);
+ int resultCode, String dataStr, Bundle extras, boolean ordered,
+ boolean sticky) throws RemoteException {
+ receiver.performReceive(intent, resultCode, dataStr, extras, ordered, sticky);
}
public void scheduleLowMemory() {
diff --git a/core/java/android/app/ApplicationThreadNative.java b/core/java/android/app/ApplicationThreadNative.java
index 928981d..a772a8f 100644
--- a/core/java/android/app/ApplicationThreadNative.java
+++ b/core/java/android/app/ApplicationThreadNative.java
@@ -317,8 +317,9 @@
String dataStr = data.readString();
Bundle extras = data.readBundle();
boolean ordered = data.readInt() != 0;
+ boolean sticky = data.readInt() != 0;
scheduleRegisteredReceiver(receiver, intent,
- resultCode, dataStr, extras, ordered);
+ resultCode, dataStr, extras, ordered, sticky);
return true;
}
@@ -716,7 +717,7 @@
}
public void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent,
- int resultCode, String dataStr, Bundle extras, boolean ordered)
+ int resultCode, String dataStr, Bundle extras, boolean ordered, boolean sticky)
throws RemoteException {
Parcel data = Parcel.obtain();
data.writeInterfaceToken(IApplicationThread.descriptor);
@@ -726,6 +727,7 @@
data.writeString(dataStr);
data.writeBundle(extras);
data.writeInt(ordered ? 1 : 0);
+ data.writeInt(sticky ? 1 : 0);
mRemote.transact(SCHEDULE_REGISTERED_RECEIVER_TRANSACTION, data, null,
IBinder.FLAG_ONEWAY);
data.recycle();
diff --git a/core/java/android/app/IApplicationThread.java b/core/java/android/app/IApplicationThread.java
index 8dda898..89a52fd 100644
--- a/core/java/android/app/IApplicationThread.java
+++ b/core/java/android/app/IApplicationThread.java
@@ -91,7 +91,7 @@
void dumpService(FileDescriptor fd, IBinder servicetoken, String[] args)
throws RemoteException;
void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent,
- int resultCode, String data, Bundle extras, boolean ordered)
+ int resultCode, String data, Bundle extras, boolean ordered, boolean sticky)
throws RemoteException;
void scheduleLowMemory() throws RemoteException;
void scheduleActivityConfigurationChanged(IBinder token) throws RemoteException;
diff --git a/core/java/android/app/PendingIntent.java b/core/java/android/app/PendingIntent.java
index 18d9b92..be1dc4a 100644
--- a/core/java/android/app/PendingIntent.java
+++ b/core/java/android/app/PendingIntent.java
@@ -147,7 +147,7 @@
mHandler = handler;
}
public void performReceive(Intent intent, int resultCode,
- String data, Bundle extras, boolean serialized) {
+ String data, Bundle extras, boolean serialized, boolean sticky) {
mIntent = intent;
mResultCode = resultCode;
mResultData = data;
diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java
index 605647a..933c2fc 100644
--- a/core/java/android/app/SearchDialog.java
+++ b/core/java/android/app/SearchDialog.java
@@ -364,10 +364,12 @@
mGlobalSearchMode = globalSearch || searchManager.isDefaultSearchable(mSearchable);
mActivityContext = mSearchable.getActivityContext(getContext());
- createContentView();
-
// show the dialog. this will call onStart().
- if (!isShowing()) {
+ if (!isShowing()) {
+ // Recreate the search bar view every time the dialog is shown, to get rid
+ // of any bad state in the AutoCompleteTextView etc
+ createContentView();
+
// The Dialog uses a ContextThemeWrapper for the context; use this to change the
// theme out from underneath us, between the global search theme and the in-app
// search theme. They are identical except that the global search theme does not
diff --git a/core/java/android/content/BroadcastReceiver.java b/core/java/android/content/BroadcastReceiver.java
index b391c57d..b63d026 100644
--- a/core/java/android/content/BroadcastReceiver.java
+++ b/core/java/android/content/BroadcastReceiver.java
@@ -384,6 +384,24 @@
}
/**
+ * Returns true if the receiver is currently processing an ordered
+ * broadcast.
+ */
+ public final boolean isOrderedBroadcast() {
+ return mOrderedHint;
+ }
+
+ /**
+ * Returns true if the receiver is currently processing the initial
+ * value of a sticky broadcast -- that is, the value that was last
+ * broadcast and is currently held in the sticky cache, so this is
+ * not directly the result of a broadcast right now.
+ */
+ public final boolean isInitialStickyBroadcast() {
+ return mInitialStickyHint;
+ }
+
+ /**
* For internal use, sets the hint about whether this BroadcastReceiver is
* running in ordered mode.
*/
@@ -392,6 +410,14 @@
}
/**
+ * For internal use, sets the hint about whether this BroadcastReceiver is
+ * receiving the initial sticky broadcast value. @hide
+ */
+ public final void setInitialStickyHint(boolean isInitialSticky) {
+ mInitialStickyHint = isInitialSticky;
+ }
+
+ /**
* Control inclusion of debugging help for mismatched
* calls to {@ Context#registerReceiver(BroadcastReceiver, IntentFilter)
* Context.registerReceiver()}.
@@ -414,7 +440,10 @@
}
void checkSynchronousHint() {
- if (mOrderedHint) {
+ // Note that we don't assert when receiving the initial sticky value,
+ // since that may have come from an ordered broadcast. We'll catch
+ // them later when the real broadcast happens again.
+ if (mOrderedHint || mInitialStickyHint) {
return;
}
RuntimeException e = new RuntimeException(
@@ -429,5 +458,6 @@
private boolean mAbortBroadcast;
private boolean mDebugUnregister;
private boolean mOrderedHint;
+ private boolean mInitialStickyHint;
}
diff --git a/core/java/android/content/IIntentReceiver.aidl b/core/java/android/content/IIntentReceiver.aidl
index 443db2d..6f2f7c4 100755
--- a/core/java/android/content/IIntentReceiver.aidl
+++ b/core/java/android/content/IIntentReceiver.aidl
@@ -28,6 +28,6 @@
*/
oneway interface IIntentReceiver {
void performReceive(in Intent intent, int resultCode,
- String data, in Bundle extras, boolean ordered);
+ String data, in Bundle extras, boolean ordered, boolean sticky);
}
diff --git a/core/java/android/content/IntentSender.java b/core/java/android/content/IntentSender.java
index c8f7aa9..e182021 100644
--- a/core/java/android/content/IntentSender.java
+++ b/core/java/android/content/IntentSender.java
@@ -113,7 +113,7 @@
mHandler = handler;
}
public void performReceive(Intent intent, int resultCode,
- String data, Bundle extras, boolean serialized) {
+ String data, Bundle extras, boolean serialized, boolean sticky) {
mIntent = intent;
mResultCode = resultCode;
mResultData = data;
diff --git a/core/java/android/os/AsyncTask.java b/core/java/android/os/AsyncTask.java
index abfb274..7d2c698 100644
--- a/core/java/android/os/AsyncTask.java
+++ b/core/java/android/os/AsyncTask.java
@@ -413,6 +413,7 @@
}
private void finish(Result result) {
+ if (isCancelled()) result = null;
onPostExecute(result);
mStatus = Status.FINISHED;
}
diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java
index ed64766..67b8a85 100644
--- a/services/java/com/android/server/WindowManagerService.java
+++ b/services/java/com/android/server/WindowManagerService.java
@@ -3218,7 +3218,6 @@
ttoken.windows.remove(startingWindow);
ttoken.allAppWindows.remove(startingWindow);
addWindowToListInOrderLocked(startingWindow, true);
- wtoken.allAppWindows.add(startingWindow);
// Propagate other interesting state between the
// tokens. If the old token is displayed, we should
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index cd39d0d..34302b1 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -8389,7 +8389,8 @@
if (i == 0) {
finisher = new IIntentReceiver.Stub() {
public void performReceive(Intent intent, int resultCode,
- String data, Bundle extras, boolean ordered)
+ String data, Bundle extras, boolean ordered,
+ boolean sticky)
throws RemoteException {
synchronized (ActivityManagerService.this) {
mDidUpdate = true;
@@ -11571,7 +11572,7 @@
Intent intent = (Intent)allSticky.get(i);
BroadcastRecord r = new BroadcastRecord(intent, null,
null, -1, -1, null, receivers, null, 0, null, null,
- false);
+ false, true);
if (mParallelBroadcasts.size() == 0) {
scheduleBroadcastsLocked();
}
@@ -11796,7 +11797,7 @@
BroadcastRecord r = new BroadcastRecord(intent, callerApp,
callerPackage, callingPid, callingUid, requiredPermission,
registeredReceivers, resultTo, resultCode, resultData, map,
- ordered);
+ ordered, false);
if (DEBUG_BROADCAST) Log.v(
TAG, "Enqueueing parallel broadcast " + r
+ ": prev had " + mParallelBroadcasts.size());
@@ -11875,7 +11876,7 @@
|| resultTo != null) {
BroadcastRecord r = new BroadcastRecord(intent, callerApp,
callerPackage, callingPid, callingUid, requiredPermission,
- receivers, resultTo, resultCode, resultData, map, ordered);
+ receivers, resultTo, resultCode, resultData, map, ordered, false);
if (DEBUG_BROADCAST) Log.v(
TAG, "Enqueueing ordered broadcast " + r
+ ": prev had " + mOrderedBroadcasts.size());
@@ -12179,15 +12180,15 @@
}
static void performReceive(ProcessRecord app, IIntentReceiver receiver,
- Intent intent, int resultCode, String data,
- Bundle extras, boolean ordered) throws RemoteException {
+ Intent intent, int resultCode, String data, Bundle extras,
+ boolean ordered, boolean sticky) throws RemoteException {
if (app != null && app.thread != null) {
// If we have an app thread, do the call through that so it is
// correctly ordered with other one-way calls.
app.thread.scheduleRegisteredReceiver(receiver, intent, resultCode,
- data, extras, ordered);
+ data, extras, ordered, sticky);
} else {
- receiver.performReceive(intent, resultCode, data, extras, ordered);
+ receiver.performReceive(intent, resultCode, data, extras, ordered, sticky);
}
}
@@ -12251,7 +12252,7 @@
}
performReceive(filter.receiverList.app, filter.receiverList.receiver,
new Intent(r.intent), r.resultCode,
- r.resultData, r.resultExtras, r.ordered);
+ r.resultData, r.resultExtras, r.ordered, r.sticky);
if (ordered) {
r.state = BroadcastRecord.CALL_DONE_RECEIVE;
}
@@ -12384,7 +12385,7 @@
}
performReceive(r.callerApp, r.resultTo,
new Intent(r.intent), r.resultCode,
- r.resultData, r.resultExtras, false);
+ r.resultData, r.resultExtras, false, false);
} catch (RemoteException e) {
Log.w(TAG, "Failure sending broadcast result of " + r.intent, e);
}
diff --git a/services/java/com/android/server/am/BroadcastRecord.java b/services/java/com/android/server/am/BroadcastRecord.java
index da55049..db0a6cb 100644
--- a/services/java/com/android/server/am/BroadcastRecord.java
+++ b/services/java/com/android/server/am/BroadcastRecord.java
@@ -39,7 +39,9 @@
final String callerPackage; // who sent this
final int callingPid; // the pid of who sent this
final int callingUid; // the uid of who sent this
- String requiredPermission; // a permission the caller has required
+ final boolean ordered; // serialize the send to receivers?
+ final boolean sticky; // originated from existing sticky data?
+ final String requiredPermission; // a permission the caller has required
final List receivers; // contains BroadcastFilter and ResolveInfo
final IIntentReceiver resultTo; // who receives final result if non-null
long dispatchTime; // when dispatch started on this set of receivers
@@ -48,7 +50,6 @@
String resultData; // current result data value.
Bundle resultExtras; // current result extra data values.
boolean resultAbort; // current result abortBroadcast value.
- boolean ordered; // serialize the send to receivers?
int nextReceiver; // next receiver to be executed.
IBinder receiver; // who is currently running, null if none.
int state;
@@ -86,7 +87,7 @@
+ " resultCode=" + resultCode + " resultData=" + resultData);
pw.println(prefix + "resultExtras=" + resultExtras);
pw.println(prefix + "resultAbort=" + resultAbort
- + " ordered=" + ordered);
+ + " ordered=" + ordered + " sticky=" + sticky);
pw.println(prefix + "nextReceiver=" + nextReceiver
+ " receiver=" + receiver);
pw.println(prefix + "curFilter=" + curFilter);
@@ -122,7 +123,8 @@
BroadcastRecord(Intent _intent, ProcessRecord _callerApp, String _callerPackage,
int _callingPid, int _callingUid, String _requiredPermission,
List _receivers, IIntentReceiver _resultTo, int _resultCode,
- String _resultData, Bundle _resultExtras, boolean _serialized) {
+ String _resultData, Bundle _resultExtras, boolean _serialized,
+ boolean _sticky) {
intent = _intent;
callerApp = _callerApp;
callerPackage = _callerPackage;
@@ -135,6 +137,7 @@
resultData = _resultData;
resultExtras = _resultExtras;
ordered = _serialized;
+ sticky = _sticky;
nextReceiver = 0;
state = IDLE;
}
diff --git a/services/java/com/android/server/am/PendingIntentRecord.java b/services/java/com/android/server/am/PendingIntentRecord.java
index a753d05..b3086d5 100644
--- a/services/java/com/android/server/am/PendingIntentRecord.java
+++ b/services/java/com/android/server/am/PendingIntentRecord.java
@@ -248,7 +248,7 @@
if (sendFinish) {
try {
finishedReceiver.performReceive(new Intent(finalIntent), 0,
- null, null, false);
+ null, null, false, false);
} catch (RemoteException e) {
}
}
diff --git a/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/BridgeTest.java b/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/BridgeTest.java
index e424f1d..c66ae37 100644
--- a/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/BridgeTest.java
+++ b/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/BridgeTest.java
@@ -73,6 +73,48 @@
}
}
+ /**
+ * Mock implementation of {@link IStyleResourceValue}.
+ */
+ private static class StyleResourceValueMock extends ResourceValue
+ implements IStyleResourceValue {
+
+ private String mParentStyle = null;
+ private HashMap<String, IResourceValue> mItems = new HashMap<String, IResourceValue>();
+
+ StyleResourceValueMock(String name) {
+ super(name);
+ }
+
+ StyleResourceValueMock(String name, String parentStyle) {
+ super(name);
+ mParentStyle = parentStyle;
+ }
+
+ public String getParentStyle() {
+ return mParentStyle;
+ }
+
+ public IResourceValue findItem(String name) {
+ return mItems.get(name);
+ }
+
+ public void addItem(IResourceValue value) {
+ mItems.put(value.getName(), value);
+ }
+
+ @Override
+ public void replaceWith(ResourceValue value) {
+ super.replaceWith(value);
+
+ if (value instanceof StyleResourceValueMock) {
+ mItems.clear();
+ mItems.putAll(((StyleResourceValueMock)value).mItems);
+ }
+ }
+ }
+
+
public void testComputeLayout() throws Exception {
TestParser parser = new TestParser();
@@ -88,8 +130,10 @@
// FIXME need a dummy font for the tests!
ILayoutResult result = mBridge.computeLayout(parser, new Integer(1) /* projectKey */,
- screenWidth, screenHeight,
- "Theme", projectResources, frameworkResources, null, null);
+ screenWidth, screenHeight, false /* full render */,
+ 160, 160f, 160f,
+ "Theme", false /* is project theme */,
+ projectResources, frameworkResources, null, null);
display(result.getRootView(), "");
}
@@ -191,7 +235,7 @@
* a style item value. If the number of string in the array is not even, an exception is thrown.
*/
private IStyleResourceValue createStyle(String styleName, String... items) {
- StyleResourceValue value = new StyleResourceValue(styleName);
+ StyleResourceValueMock value = new StyleResourceValueMock(styleName);
if (items.length % 3 == 0) {
for (int i = 0 ; i < items.length;) {
@@ -220,8 +264,10 @@
// FIXME need a dummy font for the tests!
ILayoutResult result = mBridge.computeLayout(parser, new Integer(1) /* projectKey */,
- screenWidth, screenHeight,
- "Theme", projectResources, frameworkResources, null, null);
+ screenWidth, screenHeight, false /* full render */,
+ 160, 160f, 160f,
+ "Theme", false /* is project theme */,
+ projectResources, frameworkResources, null, null);
display(result.getRootView(), "");
}
diff --git a/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/BridgeXmlBlockParserTest.java b/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/BridgeXmlBlockParserTest.java
index cac1f95..ef7442c 100644
--- a/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/BridgeXmlBlockParserTest.java
+++ b/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/BridgeXmlBlockParserTest.java
@@ -41,7 +41,7 @@
@Override
protected void setUp() throws Exception {
super.setUp();
- URL url = this.getClass().getClassLoader().getResource("data/layout1.xml");
+ URL url = this.getClass().getClassLoader().getResource("layout1.xml");
mXmlPath = url.getFile();
mDoc = getXmlDocument(mXmlPath);
}
diff --git a/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/NinePatchTest.java b/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/NinePatchTest.java
index 67ec5e1..e667472 100644
--- a/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/NinePatchTest.java
+++ b/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/NinePatchTest.java
@@ -12,7 +12,7 @@
@Override
protected void setUp() throws Exception {
- URL url = this.getClass().getClassLoader().getResource("data/button.9.png");
+ URL url = this.getClass().getClassLoader().getResource("button.9.png");
mPatch = NinePatch.load(url, false /* convert */);
}
diff --git a/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/StyleResourceValue.java b/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/StyleResourceValue.java
deleted file mode 100644
index 84bdc2f..0000000
--- a/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/StyleResourceValue.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2008 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.layoutlib.bridge;
-
-import com.android.layoutlib.api.IResourceValue;
-import com.android.layoutlib.api.IStyleResourceValue;
-
-import java.util.HashMap;
-
-class StyleResourceValue extends ResourceValue implements IStyleResourceValue {
-
- private String mParentStyle = null;
- private HashMap<String, IResourceValue> mItems = new HashMap<String, IResourceValue>();
-
- StyleResourceValue(String name) {
- super(name);
- }
-
- StyleResourceValue(String name, String parentStyle) {
- super(name);
- mParentStyle = parentStyle;
- }
-
- public String getParentStyle() {
- return mParentStyle;
- }
-
- public IResourceValue findItem(String name) {
- return mItems.get(name);
- }
-
- public void addItem(IResourceValue value) {
- mItems.put(value.getName(), value);
- }
-
- @Override
- public void replaceWith(ResourceValue value) {
- super.replaceWith(value);
-
- if (value instanceof StyleResourceValue) {
- mItems.clear();
- mItems.putAll(((StyleResourceValue)value).mItems);
- }
- }
-
-}
diff --git a/tools/layoutlib/bridge/tests/data/button.9.png b/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/button.9.png
similarity index 100%
rename from tools/layoutlib/bridge/tests/data/button.9.png
rename to tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/button.9.png
Binary files differ
diff --git a/tools/layoutlib/bridge/tests/data/layout1.xml b/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/layout1.xml
similarity index 100%
rename from tools/layoutlib/bridge/tests/data/layout1.xml
rename to tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/layout1.xml
diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/AsmGenerator.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/AsmGenerator.java
index 1adcc17..7b55ed3e 100644
--- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/AsmGenerator.java
+++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/AsmGenerator.java
@@ -68,6 +68,7 @@
*
* @param log Output logger.
* @param osDestJar The path of the destination JAR to create.
+ * @param injectClasses The list of class from layoutlib_create to inject in layoutlib.
* @param stubMethods The list of methods to stub out. Each entry must be in the form
* "package.package.OuterClass$InnerClass#MethodName".
* @param renameClasses The list of classes to rename, must be an even list: the binary FQCN
diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java
new file mode 100644
index 0000000..5a13b0b
--- /dev/null
+++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2008 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.tools.layoutlib.create;
+
+public class CreateInfo {
+ /**
+ * The list of class from layoutlib_create to inject in layoutlib.
+ */
+ public final static Class<?>[] INJECTED_CLASSES = new Class<?>[] {
+ OverrideMethod.class,
+ MethodListener.class,
+ MethodAdapter.class,
+ CreateInfo.class
+ };
+
+ /**
+ * The list of methods to stub out. Each entry must be in the form
+ * "package.package.OuterClass$InnerClass#MethodName".
+ */
+ public final static String[] OVERRIDDEN_METHODS = new String[] {
+ "android.view.View#isInEditMode",
+ "android.content.res.Resources$Theme#obtainStyledAttributes",
+ };
+
+ /**
+ * The list of classes to rename, must be an even list: the binary FQCN
+ * of class to replace followed by the new FQCN.
+ */
+ public final static String[] RENAMED_CLASSES =
+ new String[] {
+ "android.graphics.Bitmap", "android.graphics._Original_Bitmap",
+ "android.graphics.BitmapShader", "android.graphics._Original_BitmapShader",
+ "android.graphics.Canvas", "android.graphics._Original_Canvas",
+ "android.graphics.ComposeShader", "android.graphics._Original_ComposeShader",
+ "android.graphics.LinearGradient", "android.graphics._Original_LinearGradient",
+ "android.graphics.Matrix", "android.graphics._Original_Matrix",
+ "android.graphics.Paint", "android.graphics._Original_Paint",
+ "android.graphics.Path", "android.graphics._Original_Path",
+ "android.graphics.PorterDuffXfermode", "android.graphics._Original_PorterDuffXfermode",
+ "android.graphics.RadialGradient", "android.graphics._Original_RadialGradient",
+ "android.graphics.Shader", "android.graphics._Original_Shader",
+ "android.graphics.SweepGradient", "android.graphics._Original_SweepGradient",
+ "android.graphics.Typeface", "android.graphics._Original_Typeface",
+ "android.os.ServiceManager", "android.os._Original_ServiceManager",
+ "android.util.FloatMath", "android.util._Original_FloatMath",
+ "android.view.SurfaceView", "android.view._Original_SurfaceView",
+ "android.view.accessibility.AccessibilityManager", "android.view.accessibility._Original_AccessibilityManager",
+ };
+
+ /**
+ * List of classes for which the methods returning them should be deleted.
+ * The array contains a list of null terminated section starting with the name of the class
+ * to rename in which the methods are deleted, followed by a list of return types identifying
+ * the methods to delete.
+ */
+ public final static String[] REMOVED_METHODS =
+ new String[] {
+ "android.graphics.Paint", // class to delete methods from
+ "android.graphics.Paint$Align", // list of type identifying methods to delete
+ "android.graphics.Paint$Style",
+ "android.graphics.Paint$Join",
+ "android.graphics.Paint$Cap",
+ "android.graphics.Paint$FontMetrics",
+ "android.graphics.Paint$FontMetricsInt",
+ null }; // separator, for next class/methods list.
+}
+
diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/Main.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/Main.java
index 47184f1..303f097 100644
--- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/Main.java
+++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/Main.java
@@ -43,44 +43,10 @@
try {
AsmGenerator agen = new AsmGenerator(log, osDestJar[0],
- new Class<?>[] { // classes to inject in the final JAR
- OverrideMethod.class,
- MethodListener.class,
- MethodAdapter.class
- },
- new String[] { // methods to force override
- "android.view.View#isInEditMode",
- "android.content.res.Resources$Theme#obtainStyledAttributes",
- },
- new String[] { // classes to rename (so that we can replace them in layoutlib)
- // original-platform-class-name ======> renamed-class-name
- "android.graphics.Bitmap", "android.graphics._Original_Bitmap",
- "android.graphics.BitmapShader", "android.graphics._Original_BitmapShader",
- "android.graphics.Canvas", "android.graphics._Original_Canvas",
- "android.graphics.ComposeShader", "android.graphics._Original_ComposeShader",
- "android.graphics.LinearGradient", "android.graphics._Original_LinearGradient",
- "android.graphics.Matrix", "android.graphics._Original_Matrix",
- "android.graphics.Paint", "android.graphics._Original_Paint",
- "android.graphics.Path", "android.graphics._Original_Path",
- "android.graphics.PorterDuffXfermode", "android.graphics._Original_PorterDuffXfermode",
- "android.graphics.RadialGradient", "android.graphics._Original_RadialGradient",
- "android.graphics.Shader", "android.graphics._Original_Shader",
- "android.graphics.SweepGradient", "android.graphics._Original_SweepGradient",
- "android.graphics.Typeface", "android.graphics._Original_Typeface",
- "android.os.ServiceManager", "android.os._Original_ServiceManager",
- "android.util.FloatMath", "android.util._Original_FloatMath",
- "android.view.SurfaceView", "android.view._Original_SurfaceView",
- "android.view.accessibility.AccessibilityManager", "android.view.accessibility._Original_AccessibilityManager",
- },
- new String[] { // methods deleted from their return type.
- "android.graphics.Paint", // class to delete method from
- "android.graphics.Paint$Align", // list of type identifying methods to delete
- "android.graphics.Paint$Style",
- "android.graphics.Paint$Join",
- "android.graphics.Paint$Cap",
- "android.graphics.Paint$FontMetrics",
- "android.graphics.Paint$FontMetricsInt",
- null }
+ CreateInfo.INJECTED_CLASSES,
+ CreateInfo.OVERRIDDEN_METHODS,
+ CreateInfo.RENAMED_CLASSES,
+ CreateInfo.REMOVED_METHODS
);
AsmAnalyzer aa = new AsmAnalyzer(log, osJarPath, agen,