Merge change 22257 into eclair
* changes:
first step for fixing [2066786] EGL object lifetime management doesn't respect the EGL spec
diff --git a/Android.mk b/Android.mk
index 2bc83b3..3653c7b 100644
--- a/Android.mk
+++ b/Android.mk
@@ -126,8 +126,6 @@
core/java/android/view/IWindow.aidl \
core/java/android/view/IWindowManager.aidl \
core/java/android/view/IWindowSession.aidl \
- core/java/android/speech/IRecognitionListener.aidl \
- core/java/android/speech/IRecognitionService.aidl \
core/java/android/speech/tts/ITts.aidl \
core/java/android/speech/tts/ITtsCallback.aidl \
core/java/com/android/internal/app/IBatteryStats.aidl \
@@ -143,7 +141,6 @@
core/java/com/android/internal/view/IInputMethodClient.aidl \
core/java/com/android/internal/view/IInputMethodManager.aidl \
core/java/com/android/internal/view/IInputMethodSession.aidl \
- im/java/android/im/IImPlugin.aidl \
location/java/android/location/IGeocodeProvider.aidl \
location/java/android/location/IGpsStatusListener.aidl \
location/java/android/location/IGpsStatusProvider.aidl \
@@ -230,7 +227,6 @@
frameworks/base/graphics/java/android/graphics/Bitmap.aidl \
frameworks/base/graphics/java/android/graphics/Rect.aidl \
frameworks/base/graphics/java/android/graphics/Region.aidl \
- frameworks/base/im/java/android/im/IImPlugin.aidl \
frameworks/base/location/java/android/location/Criteria.aidl \
frameworks/base/location/java/android/location/Location.aidl \
frameworks/base/telephony/java/android/telephony/ServiceState.aidl \
@@ -341,7 +337,7 @@
-since ./frameworks/base/api/1.xml 1 \
-since ./frameworks/base/api/2.xml 2 \
-since ./frameworks/base/api/3.xml 3 \
- -since ./frameworks/base/api/current.xml Donut \
+ -since ./frameworks/base/api/4.xml 4 \
-error 1 -error 2 -warning 3 -error 4 -error 6 -error 8 \
-overview $(LOCAL_PATH)/core/java/overview.html
@@ -353,10 +349,18 @@
-hdf android.hasSamples 1 \
-samplecode $(sample_dir)/ApiDemos \
guide/samples/ApiDemos "API Demos" \
+ -samplecode $(sample_dir)/Home \
+ guide/samples/Home "Home" \
+ -samplecode $(sample_dir)/JetBoy \
+ guide/samples/JetBoy "JetBoy" \
-samplecode $(sample_dir)/LunarLander \
guide/samples/LunarLander "Lunar Lander" \
-samplecode $(sample_dir)/NotePad \
- guide/samples/NotePad "Note Pad"
+ guide/samples/NotePad "Note Pad" \
+ -samplecode $(sample_dir)/Snake \
+ guide/samples/Snake "Snake" \
+ -samplecode $(sample_dir)/SoftKeyboard \
+ guide/samples/SoftKeyboard "Soft Keyboard"
## SDK version identifiers used in the published docs
# major[.minor] version for current SDK. (full releases only)
diff --git a/api/current.xml b/api/current.xml
index 805917b..2d7ee31 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -4200,17 +4200,6 @@
visibility="public"
>
</field>
-<field name="includeInGlobalSearch"
- type="int"
- transient="false"
- volatile="false"
- value="16843374"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
<field name="indeterminate"
type="int"
transient="false"
@@ -6279,17 +6268,6 @@
visibility="public"
>
</field>
-<field name="queryAfterZeroResults"
- type="int"
- transient="false"
- volatile="false"
- value="16843394"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
<field name="radioButtonStyle"
type="int"
transient="false"
@@ -6785,17 +6763,6 @@
visibility="public"
>
</field>
-<field name="searchSettingsDescription"
- type="int"
- transient="false"
- volatile="false"
- value="16843402"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
<field name="searchSuggestAuthority"
type="int"
transient="false"
@@ -6851,17 +6818,6 @@
visibility="public"
>
</field>
-<field name="searchSuggestThreshold"
- type="int"
- transient="false"
- volatile="false"
- value="16843373"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
<field name="secondaryProgress"
type="int"
transient="false"
@@ -14976,7 +14932,7 @@
synchronized="false"
static="false"
final="false"
- deprecated="deprecated"
+ deprecated="not deprecated"
visibility="public"
>
<parameter name="response" type="android.accounts.IAccountAuthenticatorResponse">
@@ -21612,6 +21568,19 @@
<parameter name="intent" type="android.content.Intent">
</parameter>
</method>
+<method name="setIntentRedelivery"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="enabled" type="boolean">
+</parameter>
+</method>
</class>
<class name="KeyguardManager"
extends="java.lang.Object"
@@ -23471,17 +23440,6 @@
visibility="public"
>
</field>
-<field name="INTENT_ACTION_WEB_SEARCH_SETTINGS"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value=""android.search.action.WEB_SEARCH_SETTINGS""
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
<field name="MENU_KEY"
type="char"
transient="false"
@@ -23515,17 +23473,6 @@
visibility="public"
>
</field>
-<field name="SHORTCUT_MIME_TYPE"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value=""vnd.android.cursor.item/vnd.android.search.suggest""
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
<field name="SUGGEST_COLUMN_FORMAT"
type="java.lang.String"
transient="false"
@@ -23614,28 +23561,6 @@
visibility="public"
>
</field>
-<field name="SUGGEST_COLUMN_SHORTCUT_ID"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value=""suggest_shortcut_id""
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="SUGGEST_COLUMN_SPINNER_WHILE_REFRESHING"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value=""suggest_spinner_while_refreshing""
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
<field name="SUGGEST_COLUMN_TEXT_1"
type="java.lang.String"
transient="false"
@@ -23669,17 +23594,6 @@
visibility="public"
>
</field>
-<field name="SUGGEST_NEVER_MAKE_SHORTCUT"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value=""_-1""
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
<field name="SUGGEST_URI_PATH_QUERY"
type="java.lang.String"
transient="false"
@@ -23691,17 +23605,6 @@
visibility="public"
>
</field>
-<field name="SUGGEST_URI_PATH_SHORTCUT"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value=""search_suggest_shortcut""
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
<field name="USER_QUERY"
type="java.lang.String"
transient="false"
@@ -23877,11 +23780,28 @@
synchronized="false"
static="false"
final="false"
+ deprecated="deprecated"
+ visibility="public"
+>
+<parameter name="intent" type="android.content.Intent">
+</parameter>
+<parameter name="startId" type="int">
+</parameter>
+</method>
+<method name="onStartCommand"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="intent" type="android.content.Intent">
</parameter>
+<parameter name="flags" type="int">
+</parameter>
<parameter name="startId" type="int">
</parameter>
</method>
@@ -23976,6 +23896,83 @@
<parameter name="startId" type="int">
</parameter>
</method>
+<field name="START_CONTINUATION_MASK"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="15"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="START_FLAG_REDELIVERY"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="START_FLAG_RETRY"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="START_NOT_STICKY"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="START_REDELIVER_INTENT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="START_STICKY"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="START_STICKY_COMPATIBILITY"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="0"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
</class>
<class name="TabActivity"
extends="android.app.ActivityGroup"
@@ -95119,6 +95116,17 @@
visibility="public"
>
</field>
+<field name="ECLAIR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="10000"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
</class>
<class name="Bundle"
extends="java.lang.Object"
@@ -115554,7 +115562,7 @@
synchronized="false"
static="false"
final="false"
- deprecated="not deprecated"
+ deprecated="deprecated"
visibility="public"
>
<parameter name="asu" type="int">
diff --git a/core/java/android/accounts/AccountManager.java b/core/java/android/accounts/AccountManager.java
index 9f70534..d04abe5 100644
--- a/core/java/android/accounts/AccountManager.java
+++ b/core/java/android/accounts/AccountManager.java
@@ -261,6 +261,7 @@
}
/** @deprecated use {@link #confirmCredentials} instead */
+ @Deprecated
public AccountManagerFuture<Boolean> confirmPassword(final Account account, final String password,
AccountManagerCallback<Boolean> callback, Handler handler) {
return new Future2Task<Boolean>(handler, callback) {
diff --git a/core/java/android/accounts/AccountManagerFuture.java b/core/java/android/accounts/AccountManagerFuture.java
index 9939398..74d83eb 100644
--- a/core/java/android/accounts/AccountManagerFuture.java
+++ b/core/java/android/accounts/AccountManagerFuture.java
@@ -56,9 +56,11 @@
V getResult(long timeout, TimeUnit unit)
throws OperationCanceledException, IOException, AuthenticatorException;
+ /** @deprecated Use {@link #getResult} */
@Deprecated
V get() throws InterruptedException, ExecutionException;
+ /** @deprecated Use {@link #getResult} */
@Deprecated
V get(long timeout, TimeUnit unit)
throws InterruptedException, ExecutionException, TimeoutException;
diff --git a/core/java/android/accounts/IAccountAuthenticator.aidl b/core/java/android/accounts/IAccountAuthenticator.aidl
index 48f053c..1592eea 100644
--- a/core/java/android/accounts/IAccountAuthenticator.aidl
+++ b/core/java/android/accounts/IAccountAuthenticator.aidl
@@ -32,7 +32,7 @@
/**
* Checks that the account/password combination is valid.
- * @deprecated
+ * note -- deprecated
*/
void confirmPassword(in IAccountAuthenticatorResponse response,
in Account account, String password);
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index 4dc23c0..d14ec15 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -608,7 +608,10 @@
case SERVICE_DONE_EXECUTING_TRANSACTION: {
data.enforceInterface(IActivityManager.descriptor);
IBinder token = data.readStrongBinder();
- serviceDoneExecuting(token);
+ int type = data.readInt();
+ int startId = data.readInt();
+ int res = data.readInt();
+ serviceDoneExecuting(token, type, startId, res);
reply.writeNoException();
return true;
}
@@ -1746,11 +1749,15 @@
reply.recycle();
}
- public void serviceDoneExecuting(IBinder token) throws RemoteException {
+ public void serviceDoneExecuting(IBinder token, int type, int startId,
+ int res) throws RemoteException {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
data.writeInterfaceToken(IActivityManager.descriptor);
data.writeStrongBinder(token);
+ data.writeInt(type);
+ data.writeInt(startId);
+ data.writeInt(res);
mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
reply.readException();
data.recycle();
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index e045105..1e915b4 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -1215,6 +1215,7 @@
private static final class ServiceArgsData {
IBinder token;
int startId;
+ int flags;
Intent args;
public String toString() {
return "ServiceArgsData{token=" + token + " startId=" + startId
@@ -1417,10 +1418,11 @@
}
public final void scheduleServiceArgs(IBinder token, int startId,
- Intent args) {
+ int flags ,Intent args) {
ServiceArgsData s = new ServiceArgsData();
s.token = token;
s.startId = startId;
+ s.flags = flags;
s.args = args;
queueOrSendMessage(H.SERVICE_ARGS, s);
@@ -2684,7 +2686,8 @@
service.onCreate();
mServices.put(data.token, service);
try {
- ActivityManagerNative.getDefault().serviceDoneExecuting(data.token);
+ ActivityManagerNative.getDefault().serviceDoneExecuting(
+ data.token, 0, 0, 0);
} catch (RemoteException e) {
// nothing to do.
}
@@ -2710,7 +2713,7 @@
} else {
s.onRebind(data.intent);
ActivityManagerNative.getDefault().serviceDoneExecuting(
- data.token);
+ data.token, 0, 0, 0);
}
} catch (RemoteException ex) {
}
@@ -2736,7 +2739,7 @@
data.token, data.intent, doRebind);
} else {
ActivityManagerNative.getDefault().serviceDoneExecuting(
- data.token);
+ data.token, 0, 0, 0);
}
} catch (RemoteException ex) {
}
@@ -2773,9 +2776,10 @@
if (data.args != null) {
data.args.setExtrasClassLoader(s.getClassLoader());
}
- s.onStart(data.args, data.startId);
+ int res = s.onStartCommand(data.args, data.flags, data.startId);
try {
- ActivityManagerNative.getDefault().serviceDoneExecuting(data.token);
+ ActivityManagerNative.getDefault().serviceDoneExecuting(
+ data.token, 1, data.startId, res);
} catch (RemoteException e) {
// nothing to do.
}
@@ -2801,7 +2805,8 @@
((ApplicationContext) context).scheduleFinalCleanup(who, "Service");
}
try {
- ActivityManagerNative.getDefault().serviceDoneExecuting(token);
+ ActivityManagerNative.getDefault().serviceDoneExecuting(
+ token, 0, 0, 0);
} catch (RemoteException e) {
// nothing to do.
}
diff --git a/core/java/android/app/ApplicationThreadNative.java b/core/java/android/app/ApplicationThreadNative.java
index 5335239..ad64465 100644
--- a/core/java/android/app/ApplicationThreadNative.java
+++ b/core/java/android/app/ApplicationThreadNative.java
@@ -206,8 +206,14 @@
data.enforceInterface(IApplicationThread.descriptor);
IBinder token = data.readStrongBinder();
int startId = data.readInt();
- Intent args = Intent.CREATOR.createFromParcel(data);
- scheduleServiceArgs(token, startId, args);
+ int fl = data.readInt();
+ Intent args;
+ if (data.readInt() != 0) {
+ args = Intent.CREATOR.createFromParcel(data);
+ } else {
+ args = null;
+ }
+ scheduleServiceArgs(token, startId, fl, args);
return true;
}
@@ -573,12 +579,18 @@
}
public final void scheduleServiceArgs(IBinder token, int startId,
- Intent args) throws RemoteException {
+ int flags, Intent args) throws RemoteException {
Parcel data = Parcel.obtain();
data.writeInterfaceToken(IApplicationThread.descriptor);
data.writeStrongBinder(token);
data.writeInt(startId);
- args.writeToParcel(data, 0);
+ data.writeInt(flags);
+ if (args != null) {
+ data.writeInt(1);
+ args.writeToParcel(data, 0);
+ } else {
+ data.writeInt(0);
+ }
mRemote.transact(SCHEDULE_SERVICE_ARGS_TRANSACTION, data, null,
IBinder.FLAG_ONEWAY);
data.recycle();
diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java
index 45c202d..c3e7224 100644
--- a/core/java/android/app/IActivityManager.java
+++ b/core/java/android/app/IActivityManager.java
@@ -149,7 +149,8 @@
public void unbindFinished(IBinder token, Intent service,
boolean doRebind) throws RemoteException;
/* oneway */
- public void serviceDoneExecuting(IBinder token) throws RemoteException;
+ public void serviceDoneExecuting(IBinder token, int type, int startId,
+ int res) throws RemoteException;
public IBinder peekService(Intent service, String resolvedType) throws RemoteException;
public boolean bindBackupAgent(ApplicationInfo appInfo, int backupRestoreMode)
diff --git a/core/java/android/app/IApplicationThread.java b/core/java/android/app/IApplicationThread.java
index c915770..6faaa34 100644
--- a/core/java/android/app/IApplicationThread.java
+++ b/core/java/android/app/IApplicationThread.java
@@ -71,7 +71,8 @@
Intent intent, boolean rebind) throws RemoteException;
void scheduleUnbindService(IBinder token,
Intent intent) throws RemoteException;
- void scheduleServiceArgs(IBinder token, int startId, Intent args) throws RemoteException;
+ void scheduleServiceArgs(IBinder token, int startId, int flags, Intent args)
+ throws RemoteException;
void scheduleStopService(IBinder token) throws RemoteException;
static final int DEBUG_OFF = 0;
static final int DEBUG_ON = 1;
diff --git a/core/java/android/app/IntentService.java b/core/java/android/app/IntentService.java
index 2b12a2a..804c8eb 100644
--- a/core/java/android/app/IntentService.java
+++ b/core/java/android/app/IntentService.java
@@ -18,6 +18,7 @@
private volatile Looper mServiceLooper;
private volatile ServiceHandler mServiceHandler;
private String mName;
+ private boolean mRedelivery;
private final class ServiceHandler extends Handler {
public ServiceHandler(Looper looper) {
@@ -36,6 +37,19 @@
mName = name;
}
+ /**
+ * Control redelivery of intents. If called with true,
+ * {@link #onStartCommand(Intent, int, int)} will return
+ * {@link Service#START_REDELIVER_INTENT} instead of
+ * {@link Service#START_NOT_STICKY}, so that if this service's process
+ * is called while it is executing the Intent in
+ * {@link #onHandleIntent(Intent)}, then when later restarted the same Intent
+ * will be re-delivered to it, to retry its execution.
+ */
+ public void setIntentRedelivery(boolean enabled) {
+ mRedelivery = enabled;
+ }
+
@Override
public void onCreate() {
super.onCreate();
@@ -48,7 +62,6 @@
@Override
public void onStart(Intent intent, int startId) {
- super.onStart(intent, startId);
Message msg = mServiceHandler.obtainMessage();
msg.arg1 = startId;
msg.obj = intent;
@@ -56,6 +69,12 @@
}
@Override
+ public int onStartCommand(Intent intent, int flags, int startId) {
+ onStart(intent, startId);
+ return mRedelivery ? START_REDELIVER_INTENT : START_NOT_STICKY;
+ }
+
+ @Override
public void onDestroy() {
mServiceLooper.quit();
}
diff --git a/core/java/android/app/SearchManager.java b/core/java/android/app/SearchManager.java
index a460d19..e43834a 100644
--- a/core/java/android/app/SearchManager.java
+++ b/core/java/android/app/SearchManager.java
@@ -52,8 +52,6 @@
* <li><a href="#HowSearchIsInvoked">How Search Is Invoked</a>
* <li><a href="#ImplementingSearchForYourApp">Implementing Search for Your App</a>
* <li><a href="#Suggestions">Search Suggestions</a>
- * <li><a href="#ExposingSearchSuggestionsToQuickSearchBox">Exposing Search Suggestions to
- * Quick Search Box</a></li>
* <li><a href="#ActionKeys">Action Keys</a>
* <li><a href="#SearchabilityMetadata">Searchability Metadata</a>
* <li><a href="#PassingSearchContext">Passing Search Context</a>
@@ -249,12 +247,6 @@
* <li>Summaries of possible results</li>
* </ul>
*
- * <p>Once an application is configured to provide search suggestions, those same suggestions can
- * easily be made available to the system-wide Quick Search Box, providing faster access to its
- * content from on central prominent place. See
- * <a href="#ExposingSearchSuggestionsToQuickSearchBox">Exposing Search Suggestions to Quick Search
- * Box</a> for more details.
- *
* <p>The primary form of suggestions is known as <i>queried suggestions</i> and is based on query
* text that the user has already typed. This would generally be based on partial matches in
* the available data. In certain situations - for example, when no query text has been typed yet -
@@ -489,26 +481,6 @@
* {@link android.content.Intent#ACTION_SEARCH ACTION_SEARCH}, optional otherwise.</td>
* </tr>
*
- * <tr><th>{@link #SUGGEST_COLUMN_SHORTCUT_ID}</th>
- * <td>This column is used to indicate whether a search suggestion should be stored as a
- * shortcut, and whether it should be validated. Shortcuts are usually formed when the
- * user clicks a suggestion from Quick Search Box. If missing, the result will be
- * stored as a shortcut and never refreshed. If set to
- * {@link #SUGGEST_NEVER_MAKE_SHORTCUT}, the result will not be stored as a shortcut.
- * Otherwise, the shortcut id will be used to check back for for an up to date
- * suggestion using {@link #SUGGEST_URI_PATH_SHORTCUT}. Read more about shortcut
- * refreshing in the section about
- * <a href="#ExposingSearchSuggestionsToQuickSearchBox">exposing search suggestions to
- * Quick Search Box</a>.</td>
- * <td align="center">No. Only applicable to sources included in Quick Search Box.</td>
- * </tr>
- *
- * <tr><th>{@link #SUGGEST_COLUMN_SPINNER_WHILE_REFRESHING}</th>
- * <td>This column is used to specify that a spinner should be shown in lieu of an icon2
- * while the shortcut of this suggestion is being refreshed.</td>
- * <td align="center">No. Only applicable to sources included in Quick Search Box.</td>
- * </tr>
- *
* <tr><th><i>Other Columns</i></th>
* <td>Finally, if you have defined any <a href="#ActionKeys">Action Keys</a> and you wish
* for them to have suggestion-specific definitions, you'll need to define one
@@ -582,59 +554,6 @@
* query text is provided and the SUGGEST_COLUMN_INTENT_DATA values are not suitable for user
* inspection and editing.</li></ul>
*
- * <a name="ExposingSearchSuggestionsToQuickSearchBox"></a>
- * <h3>Exposing Search Suggestions to Quick Search Box</h3>
- *
- * <p>Once your application is setup to provide search suggestions, making them available to the
- * globally accessable Quick Search Box is as easy as setting android:includeInGlobalSearch to
- * "true" in your searchable metadata file. Beyond that, here are some more details of how
- * suggestions interact with Quick Search Box, and optional ways that you may customize suggestions
- * for your application.
- *
- * <p><b>Source Ranking:</b> Once your application's search results are made available to Quick
- * Search Box, how they surface to the user for a particular query will depend on how many
- * other apps have results for that query, and how often the user has clicked on your results
- * compared to the other apps'. The apps with the best track record within Quick Search
- * Box will get queried earlier and have a better chance of showing their results in the top few
- * slots. If there are more results than can be displayed to the user within a screen or two, the
- * results may spill into a "more results" section that groups the remaining results by
- * source. The newest apps with little usage information are given middle of the road positioning
- * until enough usage information is available to rank it as usual. The exact formula for ranking
- * the results is not set in stone, but suffice it is to say that providing quality results will
- * increase the likelihood that your app's suggestions are provided in a prominent position, and
- * apps that provide lower quality suggestions will be more likely to be pushed into the spillover
- * area.
- *
- * <p><b>Search Settings:</b> Each app that is available to Quick Search Box has an entry in the
- * system settings where the user can enable or disable the inclusion of its results. Below the
- * name of the application, each application may provide a brief description of what kind of
- * information will be made available via a search settings description string pointed to by the
- * android:searchSettingsDescription attribute in the searchable metadata.
- *
- * <p><b>Shortcuts:</b> Suggestions that are clicked on by the user are automatically made into
- * shortcuts, or, copied so they can quickly be displayed to the user before querying any of
- * the sources. Thereafter, the shortcutted suggestion will be displayed for the query that yielded
- * the suggestion and for any prefixes of that query. When multiple shortcuts are made available
- * for a given query, they are ranked based on recency and the number of clicks they have received.
- * You can control how your suggestions are made into shortcuts, and whether they are refreshed,
- * using the {@link #SUGGEST_COLUMN_SHORTCUT_ID} column:
- * <ul><li>Suggestions that do not include a shortcut id column will be made into shortcuts and
- * never refreshed. This makes sense for suggestions that refer to data that will never be changed
- * or removed.</li>
- * <li>Suggestions that include a shortcut id will be re-queried for a fresh version of the
- * suggestion each time the shortcut is displayed. The shortcut will be quickly displayed with
- * whatever data was most recently available until the refresh query returns, after which the
- * suggestion will be dynamically refreshed with the up to date information. The shortcut refresh
- * query will be sent to your suggestion provider with a uri of {@link #SUGGEST_URI_PATH_SHORTCUT}.
- * The result should contain one suggestion using the same columns as the suggestion query, or be
- * empty, indicating that the shortcut is no longer valid. Shortcut ids make sense when referring
- * to data that may change over time, such as a contact's presence status. If a suggestion refers
- * to data that could take longer to refresh, such as a network based refresh of a stock quote, you
- * may include {@link #SUGGEST_COLUMN_SPINNER_WHILE_REFRESHING} to show a progress spinner for the
- * right hand icon until the refresh is complete.</li>
- * <li>Finally, to prevent a suggestion from being copied into a shortcut, you may provide a
- * shortcut id with a value of {@link #SUGGEST_NEVER_MAKE_SHORTCUT}.</li></ul>
- *
* <a name="ActionKeys"></a>
* <h3>Action Keys</h3>
*
@@ -951,47 +870,6 @@
* </tbody>
* </table>
*
- * <p>Elements of search metadata that configure search suggestions being available to Quick Search
- * Box:
- * <table border="2" width="85%" align="center" frame="hsides" rules="rows">
- *
- * <thead>
- * <tr><th>Attribute</th> <th>Description</th> <th>Required?</th></tr>
- * </thead>
- *
- * <tr><th>android:includeInGlobalSearch</th>
- * <td>If true, indicates the search suggestions provided by your application should be
- * included in the globally accessible Quick Search Box. The attributes below are only
- * applicable if this is set to true.</td>
- * <td align="center">Yes</td>
- * </tr>
- *
- * <tr><th>android:searchSettingsDescription</th>
- * <td>If provided, provides a brief description of the search suggestions that are provided
- * by your application to Quick Search Box, and will be displayed in the search settings
- * entry for your application.</td>
- * <td align="center">No</td>
- * </tr>
- *
- * <tr><th>android:queryAfterZeroResults</th>
- * <td>Indicates whether a source should be invoked for supersets of queries it has
- * returned zero results for in the past. For example, if a source returned zero
- * results for "bo", it would be ignored for "bob". If set to false, this source
- * will only be ignored for a single session; the next time the search dialog is
- * invoked, all sources will be queried. The default value is false.</td>
- * <td align="center">No</td>
- * </tr>
- *
- * <tr><th>android:searchSuggestThreshold</th>
- * <td>Indicates the minimum number of characters needed to trigger a source from Quick
- * Search Box. Only guarantees that a source will not be queried for anything shorter
- * than the threshold. The default value is 0.</td>
- * <td align="center">No</td>
- * </tr>
- *
- * </tbody>
- * </table>
- *
* <p><b>Additional metadata for search action keys.</b> For each action key that you would like to
* define, you'll need to add an additional element defining that key, and using the attributes
* discussed in <a href="#ActionKeys">Action Keys</a>. A simple example is shown here:
@@ -1369,12 +1247,16 @@
* result indicates the shortcut refers to a no longer valid sugggestion.
*
* @see #SUGGEST_COLUMN_SHORTCUT_ID
+ *
+ * @hide pending enabling of global search for third parties
*/
public final static String SUGGEST_URI_PATH_SHORTCUT = "search_suggest_shortcut";
/**
* MIME type for shortcut validation. You'll use this in your suggestions content provider
* in the getType() function.
+ *
+ * @hide pending enabling of global search for third parties
*/
public final static String SHORTCUT_MIME_TYPE =
"vnd.android.cursor.item/vnd.android.search.suggest";
@@ -1387,7 +1269,7 @@
* In addition to the columns below, the suggestion columns are used to pass along the full
* suggestion so it can be shortcutted.
*
- * @hide
+ * @hide an implementation detail not part of the public api
*/
public final static String SEARCH_CLICK_REPORT_AUTHORITY =
"com.android.globalsearch.stats";
@@ -1395,21 +1277,21 @@
/**
* The path the write goes to.
*
- * @hide
+ * @hide an implementation detail not part of the public api
*/
public final static String SEARCH_CLICK_REPORT_URI_PATH = "click";
/**
* The column storing the query for the click.
*
- * @hide
+ * @hide an implementation detail not part of the public api
*/
public final static String SEARCH_CLICK_REPORT_COLUMN_QUERY = "query";
/**
* The column storing the component name of the application that was pivoted into.
*
- * @hide
+ * @hide an implementation detail not part of the public api
*/
public final static String SEARCH_CLICK_REPORT_COLUMN_COMPONENT = "component";
@@ -1494,7 +1376,7 @@
* {@link #COMPONENT_NAME_KEY}. For use by the global search system only - if other providers
* attempt to use this column, the value will be overwritten by global search.
*
- * @hide
+ * @hide an implementation detail not part of the public api
*/
public final static String SUGGEST_COLUMN_INTENT_COMPONENT_NAME = "suggest_intent_component";
/**
@@ -1519,6 +1401,8 @@
* {@link #SUGGEST_NEVER_MAKE_SHORTCUT}, the result will not be stored as a shortcut.
* Otherwise, the shortcut id will be used to check back for an up to date suggestion using
* {@link #SUGGEST_URI_PATH_SHORTCUT}.
+ *
+ * @hide pending reenabling of global search for third parties
*/
public final static String SUGGEST_COLUMN_SHORTCUT_ID = "suggest_shortcut_id";
@@ -1527,7 +1411,7 @@
* cursor item's background color if it needs a non-default background color. A non-zero value
* indicates a valid background color to override the default.
*
- * @hide For internal use, not part of the public API.
+ * @hide an implementation detail not part of the public api
*/
public final static String SUGGEST_COLUMN_BACKGROUND_COLOR = "suggest_background_color";
@@ -1535,6 +1419,8 @@
* Column name for suggestions cursor. <i>Optional.</i> This column is used to specify
* that a spinner should be shown in lieu of an icon2 while the shortcut of this suggestion
* is being refreshed.
+ *
+ * @hide pending reenabling of global search for third parties
*/
public final static String SUGGEST_COLUMN_SPINNER_WHILE_REFRESHING =
"suggest_spinner_while_refreshing";
@@ -1542,6 +1428,8 @@
/**
* Column value for suggestion column {@link #SUGGEST_COLUMN_SHORTCUT_ID} when a suggestion
* should not be stored as a shortcut in global search.
+ *
+ * @hide pending reenabling of global search for third parties
*/
public final static String SUGGEST_NEVER_MAKE_SHORTCUT = "_-1";
@@ -1588,6 +1476,8 @@
* Intent action for starting a web search provider's settings activity.
* Web search providers should handle this intent if they have provider-specific
* settings to implement.
+ *
+ * @hide implementation detail only relevent to web search providers
*/
public final static String INTENT_ACTION_WEB_SEARCH_SETTINGS
= "android.search.action.WEB_SEARCH_SETTINGS";
@@ -1602,8 +1492,7 @@
/**
* Intent action broadcasted to inform that the search settings have changed in some way.
- * Either searchables have been enabled or disabled, or a different web search provider
- * has been chosen.
+ * Either searchables have been enabled or disabled.
*/
public final static String INTENT_ACTION_SEARCH_SETTINGS_CHANGED
= "android.search.action.SETTINGS_CHANGED";
@@ -1612,7 +1501,7 @@
* If a suggestion has this value in {@link #SUGGEST_COLUMN_INTENT_ACTION},
* the search dialog will take no action.
*
- * @hide
+ * @hide an implentation detail not part of the public api
*/
public final static String INTENT_ACTION_NONE = "android.search.action.ZILCH";
@@ -1880,6 +1769,7 @@
/**
* @deprecated This method is an obsolete internal implementation detail. Do not use.
*/
+ @Deprecated
public void onCancel(DialogInterface dialog) {
throw new UnsupportedOperationException();
}
@@ -1887,6 +1777,7 @@
/**
* @deprecated This method is an obsolete internal implementation detail. Do not use.
*/
+ @Deprecated
public void onDismiss(DialogInterface dialog) {
throw new UnsupportedOperationException();
}
diff --git a/core/java/android/app/Service.java b/core/java/android/app/Service.java
index 2dedaa7..60c756b 100644
--- a/core/java/android/app/Service.java
+++ b/core/java/android/app/Service.java
@@ -22,6 +22,7 @@
import android.content.ContextWrapper;
import android.content.Context;
import android.content.res.Configuration;
+import android.os.Build;
import android.os.RemoteException;
import android.os.IBinder;
import android.util.Log;
@@ -169,21 +170,120 @@
}
/**
- * Called by the system every time a client explicitly starts the service by calling
- * {@link android.content.Context#startService}, providing the arguments it supplied and a
- * unique integer token representing the start request. Do not call this method directly.
- *
- * @param intent The Intent supplied to {@link android.content.Context#startService},
- * as given.
- * @param startId A unique integer representing this specific request to
- * start. Use with {@link #stopSelfResult(int)}.
- *
- * @see #stopSelfResult(int)
+ * @deprecated Implement {@link #onStartCommand(Intent, int, int)} instead.
*/
+ @Deprecated
public void onStart(Intent intent, int startId) {
}
/**
+ * Bits returned by {@link #onStartCommand} describing how to continue
+ * the service if it is killed. May be {@link #START_STICKY},
+ * {@link #START_NOT_STICKY}, {@link #START_REDELIVER_INTENT},
+ * or {@link #START_STICKY_COMPATIBILITY}.
+ */
+ public static final int START_CONTINUATION_MASK = 0xf;
+
+ /**
+ * Constant to return from {@link #onStartCommand}: compatibility
+ * version of {@link #START_STICKY} that does not guarantee that
+ * {@link #onStartCommand} will be called again after being killed.
+ */
+ public static final int START_STICKY_COMPATIBILITY = 0;
+
+ /**
+ * Constant to return from {@link #onStartCommand}: if this service's
+ * process is killed while it is started (after returning from
+ * {@link #onStartCommand}), then leave it in the started state but
+ * don't retain this delivered intent. Later the system will try to
+ * re-create the service, but it will <em>not</em> call
+ * {@link #onStartCommand} unless there has been a new call to
+ * {@link Context#startService Context.startService(Intent)} with a new
+ * Intent to deliver.
+ *
+ * <p>This mode makes sense for things that will be explicitly started
+ * and stopped to run for arbitrary periods of time, such as a service
+ * performing background music playback.
+ */
+ public static final int START_STICKY = 1;
+
+ /**
+ * Constant to return from {@link #onStartCommand}: if this service's
+ * process is killed while it is started (after returning from
+ * {@link #onStartCommand}), and there are no new start intents to
+ * deliver to it, then take the service out of the started state and
+ * don't recreate until a future explicit call to
+ * {@link Context#startService Context.startService(Intent)}.
+ *
+ * <p>This mode makes sense for things that want to do some work as a
+ * result of being started, but can be stopped when under memory pressure
+ * and will explicit start themselves again later to do more work. An
+ * example of such a service would be one that polls for data from
+ * a server: it could schedule an alarm to poll every N minutes by having
+ * the alarm start its service. When its {@link #onStartCommand} is
+ * called from the alarm, it schedules a new alarm for N minutes later,
+ * and spawns a thread to do its networking. If its process is killed
+ * while doing that check, the service will not be restarted until the
+ * alarm goes off.
+ */
+ public static final int START_NOT_STICKY = 2;
+
+ /**
+ * Constant to return from {@link #onStartCommand}: if this service's
+ * process is killed while it is started (after returning from
+ * {@link #onStartCommand}), then it will be scheduled for a restart
+ * and the last delivered Intent re-delivered to it again via
+ * {@link #onStartCommand}. This Intent will remain scheduled for
+ * redelivery until the service calls {@link #stopSelf(int)} with the
+ * start ID provided to {@link #onStartCommand}.
+ */
+ public static final int START_REDELIVER_INTENT = 3;
+
+ /**
+ * This flag is set in {@link #onStartCommand} if the Intent is a
+ * re-delivery of a previously delivered intent, because the service
+ * had previously returned {@link #START_REDELIVER_INTENT} but had been
+ * killed before calling {@link #stopSelf(int)} for that Intent.
+ */
+ public static final int START_FLAG_REDELIVERY = 0x0001;
+
+ /**
+ * This flag is set in {@link #onStartCommand} if the Intent is a
+ * a retry because the original attempt never got to or returned from
+ * {@link #onStartCommand(Intent, int, int)}.
+ */
+ public static final int START_FLAG_RETRY = 0x0002;
+
+ /**
+ * Called by the system every time a client explicitly starts the service by calling
+ * {@link android.content.Context#startService}, providing the arguments it supplied and a
+ * unique integer token representing the start request. Do not call this method directly.
+ *
+ * <p>For backwards compatibility, the default implementation calls
+ * {@link #onStart} and returns either {@link #START_STICKY}
+ * or {@link #START_STICKY_COMPATIBILITY}.
+ *
+ * @param intent The Intent supplied to {@link android.content.Context#startService},
+ * as given. This may be null if the service is being restarted after
+ * its process has gone away, and it had previously returned anything
+ * except {@link #START_STICKY_COMPATIBILITY}.
+ * @param flags Additional data about this start request. Currently either
+ * 0, {@link #START_FLAG_REDELIVERY}, or {@link #START_FLAG_RETRY}.
+ * @param startId A unique integer representing this specific request to
+ * start. Use with {@link #stopSelfResult(int)}.
+ *
+ * @return The return value indicates what semantics the system should
+ * use for the service's current started state. It may be one of the
+ * constants associated with the {@link #START_CONTINUATION_MASK} bits.
+ *
+ * @see #stopSelfResult(int)
+ */
+ public int onStartCommand(Intent intent, int flags, int startId) {
+ onStart(intent, startId);
+ return mStartCompatibility ? START_STICKY_COMPATIBILITY : START_STICKY;
+ }
+
+ /**
* Called by the system to notify a Service that it is no longer used and is being removed. The
* service should clean up an resources it holds (threads, registered
* receivers, etc) at this point. Upon return, there will be no more calls
@@ -393,6 +493,8 @@
mToken = token;
mApplication = application;
mActivityManager = (IActivityManager)activityManager;
+ mStartCompatibility = getApplicationInfo().targetSdkVersion
+ < Build.VERSION_CODES.ECLAIR;
}
final String getClassName() {
@@ -405,4 +507,5 @@
private IBinder mToken = null;
private Application mApplication = null;
private IActivityManager mActivityManager = null;
+ private boolean mStartCompatibility = false;
}
diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java
index b915803..88a4d02f 100644
--- a/core/java/android/content/ContentResolver.java
+++ b/core/java/android/content/ContentResolver.java
@@ -887,6 +887,7 @@
* @deprecated instead use
* {@link #requestSync(android.accounts.Account, String, android.os.Bundle)}
*/
+ @Deprecated
public void startSync(Uri uri, Bundle extras) {
Account account = null;
if (extras != null) {
@@ -967,6 +968,7 @@
* @param uri the uri of the provider to sync or null to sync all providers.
* @deprecated instead use {@link #cancelSync(android.accounts.Account, String)}
*/
+ @Deprecated
public void cancelSync(Uri uri) {
cancelSync(null /* all accounts */, uri != null ? uri.getAuthority() : null);
}
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index d86ab79..60551b8 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -491,42 +491,49 @@
* @deprecated Use {@link android.app.WallpaperManager#getDrawable
* WallpaperManager.get()} instead.
*/
+ @Deprecated
public abstract Drawable getWallpaper();
/**
* @deprecated Use {@link android.app.WallpaperManager#peekDrawable
* WallpaperManager.peek()} instead.
*/
+ @Deprecated
public abstract Drawable peekWallpaper();
/**
* @deprecated Use {@link android.app.WallpaperManager#getDesiredMinimumWidth()
* WallpaperManager.getDesiredMinimumWidth()} instead.
*/
+ @Deprecated
public abstract int getWallpaperDesiredMinimumWidth();
/**
* @deprecated Use {@link android.app.WallpaperManager#getDesiredMinimumHeight()
* WallpaperManager.getDesiredMinimumHeight()} instead.
*/
+ @Deprecated
public abstract int getWallpaperDesiredMinimumHeight();
/**
* @deprecated Use {@link android.app.WallpaperManager#setBitmap(Bitmap)
* WallpaperManager.set()} instead.
*/
+ @Deprecated
public abstract void setWallpaper(Bitmap bitmap) throws IOException;
/**
* @deprecated Use {@link android.app.WallpaperManager#setStream(InputStream)
* WallpaperManager.set()} instead.
*/
+ @Deprecated
public abstract void setWallpaper(InputStream data) throws IOException;
/**
* @deprecated Use {@link android.app.WallpaperManager#clear
* WallpaperManager.clear()} instead.
*/
+ @Deprecated
public abstract void clearWallpaper() throws IOException;
/**
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index a3517f8..496ab76 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -1970,9 +1970,9 @@
/**
* Used as an int extra field in {@link android.content.Intent#ACTION_DOCK_EVENT}
* intents to request the dock state. Possible values are
- * {@link android.content.Intent#ACTION_DOCK_STATE_UNDOCKED},
- * {@link android.content.Intent#ACTION_DOCK_STATE_DESK}, or
- * {@link android.content.Intent#ACTION_DOCK_STATE_CAR}.
+ * {@link android.content.Intent#EXTRA_DOCK_STATE_UNDOCKED},
+ * {@link android.content.Intent#EXTRA_DOCK_STATE_DESK}, or
+ * {@link android.content.Intent#EXTRA_DOCK_STATE_CAR}.
* @hide
*/
public static final String EXTRA_DOCK_STATE = "android.intent.extra.DOCK_STATE";
diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl
index 7760612..4fc4fb9 100644
--- a/core/java/android/content/pm/IPackageManager.aidl
+++ b/core/java/android/content/pm/IPackageManager.aidl
@@ -123,7 +123,6 @@
* providers that can sync.
* @param outInfo Filled in with a list of the ProviderInfo for each
* name in 'outNames'.
- * @deprecated
*/
void querySyncProviders(inout List<String> outNames,
inout List<ProviderInfo> outInfo);
diff --git a/core/java/android/content/pm/ProviderInfo.java b/core/java/android/content/pm/ProviderInfo.java
index d61e95b..ec01775 100644
--- a/core/java/android/content/pm/ProviderInfo.java
+++ b/core/java/android/content/pm/ProviderInfo.java
@@ -79,6 +79,7 @@
* @deprecated This flag is now being ignored. The current way to make a provider
* syncable is to provide a SyncAdapter service for a given provider/account type.
*/
+ @Deprecated
public boolean isSyncable = false;
public ProviderInfo() {
diff --git a/core/java/android/database/sqlite/SQLiteDatabase.java b/core/java/android/database/sqlite/SQLiteDatabase.java
index 184d6dc..6143b6c 100644
--- a/core/java/android/database/sqlite/SQLiteDatabase.java
+++ b/core/java/android/database/sqlite/SQLiteDatabase.java
@@ -517,6 +517,7 @@
* @deprecated if the db is locked more than once (becuase of nested transactions) then the lock
* will not be yielded. Use yieldIfContendedSafely instead.
*/
+ @Deprecated
public boolean yieldIfContended() {
return yieldIfContendedHelper(false /* do not check yielding */);
}
diff --git a/core/java/android/hardware/SensorListener.java b/core/java/android/hardware/SensorListener.java
index cfa184b..c71e968 100644
--- a/core/java/android/hardware/SensorListener.java
+++ b/core/java/android/hardware/SensorListener.java
@@ -20,9 +20,8 @@
* Used for receiving notifications from the SensorManager when
* sensor values have changed.
*
- * This interface is deprecated, use
+ * @deprecated Use
* {@link android.hardware.SensorEventListener SensorEventListener} instead.
- *
*/
@Deprecated
public interface SensorListener {
diff --git a/core/java/android/hardware/SensorManager.java b/core/java/android/hardware/SensorManager.java
index bf945ec..271f973 100644
--- a/core/java/android/hardware/SensorManager.java
+++ b/core/java/android/hardware/SensorManager.java
@@ -116,47 +116,67 @@
@Deprecated
public static final int SENSOR_ORIENTATION_RAW = 1 << 7;
- /** A constant that includes all sensors */
+ /** A constant that includes all sensors
+ * @deprecated use {@link android.hardware.Sensor Sensor} instead.
+ */
@Deprecated
public static final int SENSOR_ALL = 0x7F;
- /** Smallest sensor ID */
+ /** Smallest sensor ID
+ * @deprecated use {@link android.hardware.Sensor Sensor} instead.
+ */
@Deprecated
public static final int SENSOR_MIN = SENSOR_ORIENTATION;
- /** Largest sensor ID */
+ /** Largest sensor ID
+ * @deprecated use {@link android.hardware.Sensor Sensor} instead.
+ */
@Deprecated
public static final int SENSOR_MAX = ((SENSOR_ALL + 1)>>1);
/** Index of the X value in the array returned by
- * {@link android.hardware.SensorListener#onSensorChanged} */
+ * {@link android.hardware.SensorListener#onSensorChanged}
+ * @deprecated use {@link android.hardware.Sensor Sensor} instead.
+ */
@Deprecated
public static final int DATA_X = 0;
/** Index of the Y value in the array returned by
- * {@link android.hardware.SensorListener#onSensorChanged} */
+ * {@link android.hardware.SensorListener#onSensorChanged}
+ * @deprecated use {@link android.hardware.Sensor Sensor} instead.
+ */
@Deprecated
public static final int DATA_Y = 1;
/** Index of the Z value in the array returned by
- * {@link android.hardware.SensorListener#onSensorChanged} */
+ * {@link android.hardware.SensorListener#onSensorChanged}
+ * @deprecated use {@link android.hardware.Sensor Sensor} instead.
+ */
@Deprecated
public static final int DATA_Z = 2;
/** Offset to the untransformed values in the array returned by
- * {@link android.hardware.SensorListener#onSensorChanged} */
+ * {@link android.hardware.SensorListener#onSensorChanged}
+ * @deprecated use {@link android.hardware.Sensor Sensor} instead.
+ */
@Deprecated
public static final int RAW_DATA_INDEX = 3;
/** Index of the untransformed X value in the array returned by
- * {@link android.hardware.SensorListener#onSensorChanged} */
+ * {@link android.hardware.SensorListener#onSensorChanged}
+ * @deprecated use {@link android.hardware.Sensor Sensor} instead.
+ */
@Deprecated
public static final int RAW_DATA_X = 3;
/** Index of the untransformed Y value in the array returned by
- * {@link android.hardware.SensorListener#onSensorChanged} */
+ * {@link android.hardware.SensorListener#onSensorChanged}
+ * @deprecated use {@link android.hardware.Sensor Sensor} instead.
+ */
@Deprecated
public static final int RAW_DATA_Y = 4;
/** Index of the untransformed Z value in the array returned by
- * {@link android.hardware.SensorListener#onSensorChanged} */
+ * {@link android.hardware.SensorListener#onSensorChanged}
+ * @deprecated use {@link android.hardware.Sensor Sensor} instead.
+ */
@Deprecated
public static final int RAW_DATA_Z = 5;
diff --git a/core/java/android/net/MobileDataStateTracker.java b/core/java/android/net/MobileDataStateTracker.java
index f9effa2..f88fcdc 100644
--- a/core/java/android/net/MobileDataStateTracker.java
+++ b/core/java/android/net/MobileDataStateTracker.java
@@ -147,7 +147,10 @@
", unavailable = " + unavailable + ", reason = " +
(reason == null ? "(unspecified)" : reason));
+
if (isApnTypeIncluded(apnTypeList)) {
+ // set this even if the apn isn't Enabled
+ mNetworkInfo.setIsAvailable(!unavailable);
if (mEnabled == false) {
// if we're not enabled but the APN Type is supported by this connection
// we should record the interface name if one's provided. If the user
@@ -168,7 +171,6 @@
return;
}
- mNetworkInfo.setIsAvailable(!unavailable);
if (mMobileDataState != state) {
mMobileDataState = state;
switch (state) {
@@ -275,9 +277,21 @@
case TelephonyManager.NETWORK_TYPE_UMTS:
networkTypeStr = "umts";
break;
+ case TelephonyManager.NETWORK_TYPE_HSDPA:
+ networkTypeStr = "hsdpa";
+ break;
+ case TelephonyManager.NETWORK_TYPE_HSUPA:
+ networkTypeStr = "hsupa";
+ break;
+ case TelephonyManager.NETWORK_TYPE_HSPA:
+ networkTypeStr = "hspa";
+ break;
case TelephonyManager.NETWORK_TYPE_CDMA:
networkTypeStr = "cdma";
break;
+ case TelephonyManager.NETWORK_TYPE_1xRTT:
+ networkTypeStr = "1xrtt";
+ break;
case TelephonyManager.NETWORK_TYPE_EVDO_0:
networkTypeStr = "evdo";
break;
@@ -308,6 +322,7 @@
mEnabled = true;
// need to set self to CONNECTING so the below message is handled.
mMobileDataState = Phone.DataState.CONNECTING;
+ setDetailedState(DetailedState.CONNECTING, Phone.REASON_APN_CHANGED, null);
//send out a connected message
Intent intent = new Intent(TelephonyIntents.
ACTION_ANY_DATA_CONNECTION_STATE_CHANGED);
diff --git a/core/java/android/net/NetworkStateTracker.java b/core/java/android/net/NetworkStateTracker.java
index 418f511..54529ae 100644
--- a/core/java/android/net/NetworkStateTracker.java
+++ b/core/java/android/net/NetworkStateTracker.java
@@ -48,7 +48,7 @@
private boolean mDefaultRouteSet;
private boolean mTeardownRequested;
- private static boolean DBG = Config.LOGV;
+ private static boolean DBG = true;
private static final String TAG = "NetworkStateTracker";
public static final int EVENT_STATE_CHANGED = 1;
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
index 1775a4b..6c2a27a 100644
--- a/core/java/android/os/Build.java
+++ b/core/java/android/os/Build.java
@@ -70,6 +70,7 @@
*
* @deprecated Use {@link #SDK_INT} to easily get this as an integer.
*/
+ @Deprecated
public static final String SDK = getString("ro.build.version.sdk");
/**
@@ -132,6 +133,19 @@
* </ul>
*/
public static final int DONUT = 4;
+ /**
+ * Current work on "Eclair" development branch.
+ *
+ * <p>Applications targeting this or a later release will get these
+ * new changes in behavior:</p>
+ * <ul>
+ * <li> The {@link android.app.Service#onStartCommand
+ * Service.onStartCommand} function will return the new
+ * {@link android.app.Service#START_STICKY} behavior instead of the
+ * old compatibility {@link android.app.Service#START_STICKY_COMPATIBILITY}.
+ * </ul>
+ */
+ public static final int ECLAIR = CUR_DEVELOPMENT;
}
/** The type of build, like "user" or "eng". */
diff --git a/core/java/android/os/HandlerStateMachine.java b/core/java/android/os/HandlerStateMachine.java
index d004a25..9e7902b 100644
--- a/core/java/android/os/HandlerStateMachine.java
+++ b/core/java/android/os/HandlerStateMachine.java
@@ -56,22 +56,22 @@
}
class S1 extends HandlerState {
- @Override public void enter(Message message) {
+ &#064;Override public void enter(Message message) {
}
- @Override public void processMessage(Message message) {
+ &#064;Override public void processMessage(Message message) {
deferMessage(message);
if (message.what == TEST_WHAT_2) {
transitionTo(mS2);
}
}
- @Override public void exit(Message message) {
+ &#064;Override public void exit(Message message) {
}
}
class S2 extends HandlerState {
- @Override public void processMessage(Message message) {
+ &#064;Override public void processMessage(Message message) {
// Do some processing
if (message.what == TEST_WHAT_2) {
transtionTo(mS1);
diff --git a/core/java/android/pim/RecurrenceSet.java b/core/java/android/pim/RecurrenceSet.java
index 7920543..bd7924a 100644
--- a/core/java/android/pim/RecurrenceSet.java
+++ b/core/java/android/pim/RecurrenceSet.java
@@ -410,10 +410,14 @@
Time end = new Time(endTzid);
end.parse(dtendProperty.getValue());
- long durationMillis = end.toMillis(false /* use isDst */)
+ long durationMillis = end.toMillis(false /* use isDst */)
- start.toMillis(false /* use isDst */);
long durationSeconds = (durationMillis / 1000);
- return "P" + durationSeconds + "S";
+ if (start.allDay && (durationSeconds % 86400) == 0) {
+ return "P" + (durationSeconds / 86400) + "D"; // Server wants this instead of P86400S
+ } else {
+ return "P" + durationSeconds + "S";
+ }
}
private static String flattenProperties(ICalendar.Component component,
diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java
index 18b666c..255534d 100644
--- a/core/java/android/provider/ContactsContract.java
+++ b/core/java/android/provider/ContactsContract.java
@@ -20,7 +20,6 @@
import android.content.ContentProviderClient;
import android.content.ContentProviderOperation;
import android.content.ContentResolver;
-import android.content.ContentUris;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
@@ -192,17 +191,26 @@
/**
* Lookup value that reflects the {@link Groups#GROUP_VISIBLE} state of
- * any {@link GroupMembership} for this contact.
+ * any {@link CommonDataKinds.GroupMembership} for this contact.
*/
public static final String IN_VISIBLE_GROUP = "in_visible_group";
/**
* Contact presence status. See {@link android.provider.Im.CommonPresenceColumns}
- * for individual status definitions.
+ * for individual status definitions. This column is only returned if explicitly
+ * requested in the query projection.
+ * <p>Type: NUMBER</p>
*/
public static final String PRESENCE_STATUS = Presence.PRESENCE_STATUS;
/**
+ * Contact presence custom status. This column is only returned if explicitly
+ * requested in the query projection.
+ * <p>Type: TEXT</p>
+ */
+ public static final String PRESENCE_CUSTOM_STATUS = Presence.PRESENCE_CUSTOM_STATUS;
+
+ /**
* An indicator of whether this contact has at least one phone number. "1" if there is
* at least one phone number, "0" otherwise.
* <P>Type: INTEGER</P>
@@ -307,35 +315,18 @@
}
/**
- * Returns a URI that can be used to retrieve the contact's default photo.
- *
- * @param contactUri the contact whose photo should be used
+ * A sub-directory of a single contact that contains the contact's primary photo.
*/
- public static Uri getPhotoUri(ContentResolver cr, Uri contactUri) {
+ public static final class Photo implements BaseColumns, DataColumns {
+ /**
+ * no public constructor since this is a utility class
+ */
+ private Photo() {}
- // TODO remove try/catch block as soon as eclair-dev is merged in eclair
- try {
- long photoId = -1;
- Cursor cursor = cr.query(contactUri, new String[] {Contacts.PHOTO_ID},
- null, null, null);
- try {
- if (!cursor.moveToNext()) {
- return null;
- }
-
- if (cursor.isNull(0)) {
- return null;
- }
-
- photoId = cursor.getLong(0);
- } finally {
- cursor.close();
- }
-
- return ContentUris.withAppendedId(ContactsContract.Data.CONTENT_URI, photoId);
- } catch (Exception e) {
- return null;
- }
+ /**
+ * The directory twig for this sub-table
+ */
+ public static final String CONTENT_DIRECTORY = "photo";
}
/**
@@ -345,14 +336,14 @@
* @param contactUri the contact whose photo should be used
*/
public static InputStream openContactPhotoInputStream(ContentResolver cr, Uri contactUri) {
- Uri photoUri = getPhotoUri(cr, contactUri);
+ Uri photoUri = Uri.withAppendedPath(contactUri, Photo.CONTENT_DIRECTORY);
if (photoUri == null) {
return null;
}
Cursor cursor = cr.query(photoUri,
new String[]{ContactsContract.CommonDataKinds.Photo.PHOTO}, null, null, null);
try {
- if (!cursor.moveToNext()) {
+ if (cursor == null || !cursor.moveToNext()) {
return null;
}
byte[] data = cursor.getBlob(0);
@@ -361,7 +352,9 @@
}
return new ByteArrayInputStream(data);
} finally {
- cursor.close();
+ if (cursor != null) {
+ cursor.close();
+ }
}
}
}
@@ -656,7 +649,11 @@
/**
* Reference to the {@link RawContacts#_ID} this presence references.
* <P>Type: INTEGER</P>
+ *
+ * TODO remove this from public API
+ * @hide
*/
+ @Deprecated
public static final String RAW_CONTACT_ID = "presence_raw_contact_id";
/**
@@ -665,17 +662,27 @@
*/
public static final String DATA_ID = "presence_data_id";
- /**
- * The IM service the presence is coming from. Formatted using either
- * {@link CommonDataKinds.Im#encodePredefinedImProtocol(int)} or
- * {@link CommonDataKinds.Im#encodeCustomImProtocol(String)}.
- * <P>Type: TEXT</P>
- */
+ @Deprecated
public static final String IM_PROTOCOL = "im_protocol";
/**
- * The IM handle the presence item is for. The handle is scoped to the
- * {@link #IM_PROTOCOL}.
+ * <p>Type: NUMBER</p>
+ */
+ public static final String PROTOCOL = "protocol";
+
+ /**
+ * Name of the custom protocol. Should be supplied along with the {@link #PROTOCOL} value
+ * {@link ContactsContract.CommonDataKinds.Im#PROTOCOL_CUSTOM}. Should be null or
+ * omitted if {@link #PROTOCOL} value is not
+ * {@link ContactsContract.CommonDataKinds.Im#PROTOCOL_CUSTOM}.
+ *
+ * <p>Type: NUMBER</p>
+ */
+ public static final String CUSTOM_PROTOCOL = "custom_protocol";
+
+ /**
+ * The IM handle the presence item is for. The handle is scoped to
+ * {@link #PROTOCOL}.
* <P>Type: TEXT</P>
*/
public static final String IM_HANDLE = "im_handle";
@@ -1158,19 +1165,18 @@
public static final int TYPE_WORK = 2;
public static final int TYPE_OTHER = 3;
+ /**
+ * This column should be populated with one of the defined
+ * constants, e.g. {@link #PROTOCOL_YAHOO}. If the value of this
+ * column is {@link #PROTOCOL_CUSTOM}, the {@link #CUSTOM_PROTOCOL}
+ * should contain the name of the custom protocol.
+ */
public static final String PROTOCOL = "data5";
public static final String CUSTOM_PROTOCOL = "data6";
- /**
- * The predefined IM protocol types. The protocol can either be non-present, one
- * of these types, or a free-form string. These cases are encoded in the PROTOCOL
- * column as:
- * <ul>
- * <li>null</li>
- * <li>pre:<an integer, one of the protocols below></li>
- * <li>custom:<a string></li>
- * </ul>
+ /*
+ * The predefined IM protocol types.
*/
public static final int PROTOCOL_CUSTOM = -1;
public static final int PROTOCOL_AIM = 0;
@@ -1428,7 +1434,7 @@
/**
* The total number of {@link Contacts} that have
- * {@link GroupMembership} in this group. Read-only value that is only
+ * {@link CommonDataKinds.GroupMembership} in this group. Read-only value that is only
* present when querying {@link Groups#CONTENT_SUMMARY_URI}.
* <p>
* Type: INTEGER
@@ -1437,7 +1443,7 @@
/**
* The total number of {@link Contacts} that have both
- * {@link GroupMembership} in this group, and also have phone numbers.
+ * {@link CommonDataKinds.GroupMembership} in this group, and also have phone numbers.
* Read-only value that is only present when querying
* {@link Groups#CONTENT_SUMMARY_URI}.
* <p>
@@ -1601,39 +1607,42 @@
public static final String ACCOUNT_TYPE = "account_type";
/**
- * Setting to indicate how this source handles {@link #SHOULD_SYNC} and
- * {@link Groups#SHOULD_SYNC} flags. This mode should be one of
- * {@link Settings#SYNC_MODE_EVERYTHING},
- * {@link Settings#SYNC_MODE_UNGROUPED}, or
- * {@link Settings#SYNC_MODE_UNSUPPORTED}.
- * <p>
- * Type: INTEGER
- */
- public static final String SHOULD_SYNC_MODE = "should_sync_mode";
-
- /**
- * When modes is {@link Settings#SYNC_MODE_EVERYTHING}, this flag
- * overrides any children {@link Groups#SHOULD_SYNC} when set. When mode
- * is {@link Settings#SYNC_MODE_UNGROUPED}, this flag indicates the
- * syncing behavior for contacts not belonging to any group.
+ * Depending on the mode defined by the sync-adapter, this flag controls
+ * the top-level sync behavior for this data source.
* <p>
* Type: INTEGER (boolean)
*/
public static final String SHOULD_SYNC = "should_sync";
/**
- * Flag indicating if contacts without any {@link GroupMembership}
+ * Flag indicating if contacts without any {@link CommonDataKinds.GroupMembership}
* entries should be visible in any user interface.
* <p>
* Type: INTEGER (boolean)
*/
public static final String UNGROUPED_VISIBLE = "ungrouped_visible";
+
+ /**
+ * Read-only count of {@link Contacts} from a specific source that have
+ * no {@link GroupMembership} entries.
+ * <p>
+ * Type: INTEGER
+ */
+ public static final String UNGROUPED_COUNT = "summ_count";
+
+ /**
+ * Read-only count of {@link Contacts} from a specific source that have
+ * no {@link GroupMembership} entries, and also have phone numbers.
+ * <p>
+ * Type: INTEGER
+ */
+ public static final String UNGROUPED_WITH_PHONES = "summ_phones";
}
/**
* Contacts-specific settings for various {@link Account}.
*/
- public static final class Settings implements BaseColumns, SettingsColumns {
+ public static final class Settings implements SettingsColumns {
/**
* This utility class cannot be instantiated
*/
@@ -1656,27 +1665,6 @@
* The MIME-type of {@link #CONTENT_URI} providing a single setting.
*/
public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/setting";
-
- /**
- * Mode for {@link #SHOULD_SYNC_MODE} that indicates this data source
- * doesn't support per-group {@link Groups#SHOULD_SYNC} flags.
- */
- public static final int SYNC_MODE_UNSUPPORTED = 0;
-
- /**
- * Mode for {@link #SHOULD_SYNC_MODE} that indicates this data source
- * fully supports per-group {@link Groups#SHOULD_SYNC} flags and assumes
- * that {@link #SHOULD_SYNC} refers to contacts without any
- * {@link GroupMembership}.
- */
- public static final int SYNC_MODE_UNGROUPED = 1;
-
- /**
- * Mode for {@link #SHOULD_SYNC_MODE} that indicates this data source
- * fully supports per-group {@link Groups#SHOULD_SYNC} flags but assumes
- * that {@link #SHOULD_SYNC} overrides per-group flags when set.
- */
- public static final int SYNC_MODE_EVERYTHING = 2;
}
/**
@@ -1787,6 +1775,13 @@
public static final int MODE_LARGE = 3;
/**
+ * Optional extra used with {@link #SHOW_OR_CREATE_CONTACT} to indicate
+ * a list of specific MIME-types to exclude and not display. Stored as a
+ * {@link String} array.
+ */
+ public static final String EXTRA_EXCLUDE_MIMES = "exclude_mimes";
+
+ /**
* Intents related to the Contacts app UI.
*/
public static final class UI {
diff --git a/core/java/android/provider/Gmail.java b/core/java/android/provider/Gmail.java
index 5702e7c..4425e51 100644
--- a/core/java/android/provider/Gmail.java
+++ b/core/java/android/provider/Gmail.java
@@ -1521,8 +1521,9 @@
/**
* Returns the number of conversation with a given label.
- * @deprecated
+ * @deprecated Use {@link #getLabelId} instead.
*/
+ @Deprecated
public int getNumConversations(String label) {
return getNumConversations(getLabelId(label));
}
@@ -1534,8 +1535,9 @@
/**
* Returns the number of unread conversation with a given label.
- * @deprecated
+ * @deprecated Use {@link #getLabelId} instead.
*/
+ @Deprecated
public int getNumUnreadConversations(String label) {
return getNumUnreadConversations(getLabelId(label));
}
@@ -2040,8 +2042,9 @@
}
/**
- * @deprecated
+ * @deprecated Always returns true.
*/
+ @Deprecated
public boolean getExpanded() {
return true;
}
diff --git a/core/java/android/provider/Im.java b/core/java/android/provider/Im.java
index b1cf648..f126c4d 100644
--- a/core/java/android/provider/Im.java
+++ b/core/java/android/provider/Im.java
@@ -138,6 +138,7 @@
public static final String ACTIVE_ACCOUNT_USERNAME = "account_username";
public static final String ACTIVE_ACCOUNT_PW = "account_pw";
public static final String ACTIVE_ACCOUNT_LOCKED = "account_locked";
+ public static final String ACTIVE_ACCOUNT_KEEP_SIGNED_IN = "account_keepSignedIn";
public static final String ACCOUNT_PRESENCE_STATUS = "account_presenceStatus";
public static final String ACCOUNT_CONNECTION_STATUS = "account_connStatus";
@@ -931,6 +932,12 @@
* <P>Type: INTEGER</P>
*/
String IS_GROUP_CHAT = "is_muc";
+
+ /**
+ * A hint that the UI should show the sent time of this message
+ * <P>Type: INTEGER</P>
+ */
+ String DISPLAY_SENT_TIME = "show_ts";
}
/**
@@ -1461,7 +1468,7 @@
* <P>Type: TEXT</P>
*/
String UNSENT_COMPOSED_MESSAGE = "unsent_composed_message";
-
+
/**
* A value from 0-9 indicating which quick-switch chat screen slot this
* chat is occupying. If none (for instance, this is the 12th active chat)
diff --git a/core/java/android/provider/LiveFolders.java b/core/java/android/provider/LiveFolders.java
index 6e95fb7..19f361b 100644
--- a/core/java/android/provider/LiveFolders.java
+++ b/core/java/android/provider/LiveFolders.java
@@ -45,7 +45,7 @@
* public static class MyLiveFolder extends Activity {
* public static final Uri CONTENT_URI = Uri.parse("content://my.app/live");
*
- * @Override
+ * &#064;Override
* protected void onCreate(Bundle savedInstanceState) {
* super.onCreate(savedInstanceState);
*
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 84e07f0..ee46c85 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -1522,18 +1522,17 @@
@Deprecated
public static final String USE_GOOGLE_MAIL = Secure.USE_GOOGLE_MAIL;
-// /**
-// * @deprecated Use {@link android.provider.Settings.Secure#WIFI_MAX_DHCP_RETRY_COUNT}
-// * instead
-// */
+ /**
+ * @deprecated Use
+ * {@link android.provider.Settings.Secure#WIFI_MAX_DHCP_RETRY_COUNT} instead
+ */
@Deprecated
public static final String WIFI_MAX_DHCP_RETRY_COUNT = Secure.WIFI_MAX_DHCP_RETRY_COUNT;
-// /**
-// * @deprecated Use
-// * {@link android.provider.Settings.Secure#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS}
-// * instead
-// */
+ /**
+ * @deprecated Use
+ * {@link android.provider.Settings.Secure#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead
+ */
@Deprecated
public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
Secure.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS;
@@ -2930,6 +2929,21 @@
"gtalk_rmq2_include_stream_id";
/**
+ * when receiving a chat message from the server, the message could be an older message
+ * whose "time sent" is x seconds from now. If x is significant enough, we want to flag
+ * it so the UI can give it some special treatment when displaying the "time sent" for
+ * it. This setting is to control what x is.
+ */
+ public static final String GTALK_OLD_CHAT_MESSAGE_THRESHOLD_IN_SEC =
+ "gtalk_old_chat_msg_threshold_in_sec";
+
+ /**
+ * a setting to control the max connection history record GTalkService stores.
+ */
+ public static final String GTALK_MAX_CONNECTION_HISTORY_RECORDS =
+ "gtalk_max_conn_history_records";
+
+ /**
* This is gdata url to lookup album and picture info from picasa web.
*/
public static final String GTALK_PICASA_ALBUM_URL =
diff --git a/core/java/android/provider/Telephony.java b/core/java/android/provider/Telephony.java
index 7a6f6bb..0207330 100644
--- a/core/java/android/provider/Telephony.java
+++ b/core/java/android/provider/Telephony.java
@@ -1264,6 +1264,21 @@
}
/**
+ * Returns true if the number is a Phone number
+ *
+ * @param number the input number to be tested
+ * @return true if number is a Phone number
+ */
+ public static boolean isPhoneNumber(String number) {
+ if (TextUtils.isEmpty(number)) {
+ return false;
+ }
+
+ Matcher match = Regex.PHONE_PATTERN.matcher(number);
+ return match.matches();
+ }
+
+ /**
* Contains all MMS messages in the MMS app's inbox.
*/
public static final class Inbox implements BaseMmsColumns {
diff --git a/core/java/android/server/search/Searchables.java b/core/java/android/server/search/Searchables.java
index c615957..a2add73 100644
--- a/core/java/android/server/search/Searchables.java
+++ b/core/java/android/server/search/Searchables.java
@@ -26,6 +26,7 @@
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
+import android.content.pm.ApplicationInfo;
import android.os.Bundle;
import android.util.Log;
@@ -230,14 +231,16 @@
: webSearchInfoList.get(ii - search_count);
ActivityInfo ai = info.activityInfo;
// Check first to avoid duplicate entries.
- if (newSearchablesMap.get(new ComponentName(ai.packageName, ai.name)) == null) {
- SearchableInfo searchable = SearchableInfo.getActivityMetaData(mContext, ai);
- if (searchable != null) {
- newSearchablesList.add(searchable);
- newSearchablesMap.put(searchable.getSearchActivity(), searchable);
- if (searchable.shouldIncludeInGlobalSearch()) {
- newSearchablesInGlobalSearchList.add(searchable);
- }
+ if (newSearchablesMap.containsKey(new ComponentName(ai.packageName, ai.name))) {
+ continue;
+ }
+ SearchableInfo searchable = SearchableInfo.getActivityMetaData(mContext, ai);
+ if (searchable != null) {
+ newSearchablesList.add(searchable);
+ newSearchablesMap.put(searchable.getSearchActivity(), searchable);
+ if (searchable.shouldIncludeInGlobalSearch()
+ && isWhitelistedForGlobalSearch(pm, searchable.getSearchActivity())) {
+ newSearchablesInGlobalSearchList.add(searchable);
}
}
}
@@ -289,6 +292,25 @@
}
/**
+ * Determines whether an activity may be included in quick search box. For now this is
+ * restricted to system installed apps.
+ *
+ * TODO: remove when we are ready to enable global search for third party applications.
+ *
+ * @param pm The package manager.
+ * @param searchActivity The component of the search activity.
+ * @return True if the search activity may include its search suggestions in quick search box.
+ */
+ private boolean isWhitelistedForGlobalSearch(PackageManager pm, ComponentName searchActivity) {
+ try {
+ ActivityInfo ai = pm.getActivityInfo(searchActivity, 0);
+ return ((ai.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0);
+ } catch (PackageManager.NameNotFoundException e) {
+ return false;
+ }
+ }
+
+ /**
* Checks if the given activity component is present in the system and if so makes it the
* preferred activity for handling ACTION_WEB_SEARCH.
* @param component Name of the component to check and set as preferred.
diff --git a/core/java/android/speech/IRecognitionListener.aidl b/core/java/android/speech/IRecognitionListener.aidl
deleted file mode 100644
index 2da2258..0000000
--- a/core/java/android/speech/IRecognitionListener.aidl
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.speech;
-
-import android.os.Bundle;
-import android.speech.RecognitionResult;
-
-/**
- * Listener for speech recognition events, used with RecognitionService.
- * This gives you both the final recognition results, as well as various
- * intermediate events that can be used to show visual feedback to the user.
- * {@hide}
- */
-interface IRecognitionListener {
- /** Called when the endpointer is ready for the user to start speaking. */
- void onReadyForSpeech(in Bundle noiseParams);
-
- /** The user has started to speak. */
- void onBeginningOfSpeech();
-
- /** The sound level in the audio stream has changed. */
- void onRmsChanged(in float rmsdB);
-
- /**
- * More sound has been received. Buffer is a byte buffer containing
- * a sequence of 16-bit shorts.
- */
- void onBufferReceived(in byte[] buffer);
-
- /** Called after the user stops speaking. */
- void onEndOfSpeech();
-
- /**
- * A network or recognition error occurred. The code is defined in
- * {@link android.speech.RecognitionResult}
- */
- void onError(in int error);
-
- /**
- * Called when recognition results are ready.
- * @param results: an ordered list of the most likely results (N-best list).
- * @param key: a key associated with the results. The same results can
- * be retrieved asynchronously later using the key, if available.
- */
- void onResults(in List<RecognitionResult> results, long key);
-}
diff --git a/core/java/android/speech/IRecognitionService.aidl b/core/java/android/speech/IRecognitionService.aidl
deleted file mode 100644
index a18c380..0000000
--- a/core/java/android/speech/IRecognitionService.aidl
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.speech;
-
-import android.content.Intent;
-import android.speech.IRecognitionListener;
-import android.speech.RecognitionResult;
-
-// A Service interface to speech recognition. Call startListening when
-// you want to begin capturing audio; RecognitionService will automatically
-// determine when the user has finished speaking, stream the audio to the
-// recognition servers, and notify you when results are ready.
-/** {@hide} */
-interface IRecognitionService {
- // Start listening for speech. Can only call this from one thread at once.
- // see RecognizerIntent.java for constants used to specify the intent.
- void startListening(in Intent recognizerIntent,
- in IRecognitionListener listener);
-
- List<RecognitionResult> getRecognitionResults(in long key);
-
- void cancel();
-}
diff --git a/core/java/android/speech/RecognitionResult.aidl b/core/java/android/speech/RecognitionResult.aidl
deleted file mode 100644
index 59e53ab..0000000
--- a/core/java/android/speech/RecognitionResult.aidl
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.speech;
-
-parcelable RecognitionResult;
diff --git a/core/java/android/speech/RecognitionResult.java b/core/java/android/speech/RecognitionResult.java
deleted file mode 100644
index 978106b..0000000
--- a/core/java/android/speech/RecognitionResult.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Copyright (C) 2008 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package android.speech;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-
-/**
- * RecognitionResult is a passive object that stores a single recognized
- * query and its search result.
- * TODO: revisit and improve. May be we should have a separate result
- * object for each type, and put them (type/value) in bundle?
- *
- * {@hide}
- */
-public class RecognitionResult implements Parcelable {
- /**
- * Status of the recognize request.
- */
- public static final int NETWORK_TIMEOUT = 1; // Network operation timed out.
- public static final int NETWORK_ERROR = 2; // Other networkrelated errors.
- public static final int AUDIO_ERROR = 3; // Audio recording error.
- public static final int SERVER_ERROR = 4; // Server sends error status.
- public static final int CLIENT_ERROR = 5; // Other client side errors.
- public static final int SPEECH_TIMEOUT = 6; // No speech input
- public static final int NO_MATCH = 7; // No recognition result matched.
- public static final int SERVICE_BUSY = 8; // RecognitionService busy.
-
- /**
- * Type of the recognition results.
- */
- public static final int RAW_RECOGNITION_RESULT = 0;
- public static final int WEB_SEARCH_RESULT = 1;
- public static final int CONTACT_RESULT = 2;
-
- /**
- * A factory method to create a raw RecognitionResult
- *
- * @param sentence the recognized text.
- */
- public static RecognitionResult newRawRecognitionResult(String sentence) {
- return new RecognitionResult(RAW_RECOGNITION_RESULT, sentence, null, null);
- }
-
- /**
- * A factory method to create RecognitionResult for contacts.
- *
- * @param contact the contact name.
- * @param phoneType the phone type.
- * @param callAction whether this result included a command to "call", or just the contact name.
- */
- public static RecognitionResult newContactResult(String contact, int phoneType,
- boolean callAction) {
- return new RecognitionResult(CONTACT_RESULT, contact, phoneType, callAction);
- }
-
- /**
- * A factory method to create a RecognitionResult for Web Search Query.
- *
- * @param query the query string.
- * @param html the html page of the search result.
- * @param url the url that performs the search with the query.
- */
- public static RecognitionResult newWebResult(String query, String html, String url) {
- return new RecognitionResult(WEB_SEARCH_RESULT, query, html, url);
- }
-
- public static final Parcelable.Creator<RecognitionResult> CREATOR
- = new Parcelable.Creator<RecognitionResult>() {
-
- public RecognitionResult createFromParcel(Parcel in) {
- return new RecognitionResult(in);
- }
-
- public RecognitionResult[] newArray(int size) {
- return new RecognitionResult[size];
- }
- };
-
- /**
- * Result type.
- */
- public final int mResultType;
-
- /**
- * The recognized string when mResultType is WEB_SEARCH_RESULT.
- * The name of the contact when mResultType is CONTACT_RESULT.
- */
- public final String mText;
-
- /**
- * The HTML result page for the query. If this is null, then the
- * application must use the url field to get the HTML result page.
- */
- public final String mHtml;
-
- /**
- * The url to get the result page for the query string. The
- * application must use this url instead of performing the search
- * with the query.
- */
- public final String mUrl;
-
- /**
- * Phone number type. This is valid only when mResultType == CONTACT_RESULT.
- */
- public final int mPhoneType;
-
- /**
- * Whether a contact recognition result included a command to "call". This is valid only
- * when mResultType == CONTACT_RESULT.
- */
- public final boolean mCallAction;
-
- private RecognitionResult(int type, String query, String html, String url) {
- mResultType = type;
- mText = query;
- mHtml = html;
- mUrl = url;
- mPhoneType = -1;
- mCallAction = false;
- }
-
- private RecognitionResult(int type, String query, int phoneType, boolean callAction) {
- mResultType = type;
- mText = query;
- mPhoneType = phoneType;
- mHtml = null;
- mUrl = null;
- mCallAction = callAction;
- }
-
- private RecognitionResult(Parcel in) {
- mResultType = in.readInt();
- mText = in.readString();
- mHtml= in.readString();
- mUrl= in.readString();
- mPhoneType = in.readInt();
- mCallAction = (in.readInt() == 1);
- }
-
- public void writeToParcel(Parcel out, int flags) {
- out.writeInt(mResultType);
- out.writeString(mText);
- out.writeString(mHtml);
- out.writeString(mUrl);
- out.writeInt(mPhoneType);
- out.writeInt(mCallAction ? 1 : 0);
- }
-
-
- @Override
- public String toString() {
- String resultType[] = { "RAW", "WEB", "CONTACT" };
- return "[type=" + resultType[mResultType] +
- ", text=" + mText+ ", mUrl=" + mUrl + ", html=" + mHtml + "]";
- }
-
- public int describeContents() {
- // no special description
- return 0;
- }
-}
diff --git a/core/java/android/speech/RecognitionServiceUtil.java b/core/java/android/speech/RecognitionServiceUtil.java
deleted file mode 100644
index a8c7868..0000000
--- a/core/java/android/speech/RecognitionServiceUtil.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package android.speech;
-
-import android.content.ComponentName;
-import android.content.Intent;
-import android.content.ServiceConnection;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.os.RemoteException;
-import android.speech.RecognitionResult;
-import android.util.Log;
-
-import java.util.List;
-
-/**
- * Utils for Google's network-based speech recognizer, which lets you perform
- * speech-to-text translation through RecognitionService. IRecognitionService
- * and IRecognitionListener are the core interfaces; you begin recognition
- * through IRecognitionService and subscribe to callbacks about when the user
- * stopped speaking, results come in, errors, etc. through IRecognitionListener.
- * RecognitionServiceUtil includes default IRecognitionListener and
- * ServiceConnection implementations to reduce the amount of boilerplate.
- *
- * The Service provides no user interface. See RecognitionActivity if you
- * want the standard voice search UI.
- *
- * Below is a small skeleton of how to use the recognizer:
- *
- * ServiceConnection conn = new RecognitionServiceUtil.Connection();
- * mContext.bindService(RecognitionServiceUtil.sDefaultIntent,
- * conn, Context.BIND_AUTO_CREATE);
- * IRecognitionListener listener = new RecognitionServiceWrapper.NullListener() {
- * public void onResults(List<String> results) {
- * // Do something with recognition transcripts
- * }
- * }
- *
- * // Must wait for conn.mService to be populated, then call below
- * conn.mService.startListening(null, listener);
- *
- * {@hide}
- */
-public class RecognitionServiceUtil {
- public static final Intent sDefaultIntent = new Intent(
- RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
-
- // Recognize request parameters
- public static final String USE_LOCATION = "useLocation";
- public static final String CONTACT_AUTH_TOKEN = "contactAuthToken";
-
- // Bundles
- public static final String NOISE_LEVEL = "NoiseLevel";
- public static final String SIGNAL_NOISE_RATIO = "SignalNoiseRatio";
-
- private RecognitionServiceUtil() {}
-
- /**
- * IRecognitionListener which does nothing in response to recognition
- * callbacks. You can subclass from this and override only the methods
- * whose events you want to respond to.
- */
- public static class NullListener extends IRecognitionListener.Stub {
- public void onReadyForSpeech(Bundle bundle) {}
- public void onBeginningOfSpeech() {}
- public void onRmsChanged(float rmsdB) {}
- public void onBufferReceived(byte[] buf) {}
- public void onEndOfSpeech() {}
- public void onError(int error) {}
- public void onResults(List<RecognitionResult> results, long key) {}
- }
-
- /**
- * Basic ServiceConnection which just records mService variable.
- */
- public static class Connection implements ServiceConnection {
- public IRecognitionService mService;
-
- public synchronized void onServiceConnected(ComponentName name, IBinder service) {
- mService = IRecognitionService.Stub.asInterface(service);
- }
-
- public void onServiceDisconnected(ComponentName name) {
- mService = null;
- }
- }
-}
diff --git a/core/java/android/text/style/ImageSpan.java b/core/java/android/text/style/ImageSpan.java
index 86ef5f6..74b9463 100644
--- a/core/java/android/text/style/ImageSpan.java
+++ b/core/java/android/text/style/ImageSpan.java
@@ -36,6 +36,7 @@
/**
* @deprecated Use {@link #ImageSpan(Context, Bitmap)} instead.
*/
+ @Deprecated
public ImageSpan(Bitmap b) {
this(null, b, ALIGN_BOTTOM);
}
@@ -43,6 +44,7 @@
/**
* @deprecated Use {@link #ImageSpan(Context, Bitmap, int) instead.
*/
+ @Deprecated
public ImageSpan(Bitmap b, int verticalAlignment) {
this(null, b, verticalAlignment);
}
diff --git a/core/java/android/util/Config.java b/core/java/android/util/Config.java
index 9571041..924b49d 100644
--- a/core/java/android/util/Config.java
+++ b/core/java/android/util/Config.java
@@ -34,25 +34,25 @@
*/
/**
- * Always the inverse of DEBUG.
+ * @deprecated Use {@link #DEBUG} instead.
*/
@Deprecated
public static final boolean RELEASE = !DEBUG;
/**
- * Always false.
+ * @deprecated Always false.
*/
@Deprecated
public static final boolean PROFILE = false;
/**
- * Always false.
+ * @deprecated Always false.
*/
@Deprecated
public static final boolean LOGV = false;
/**
- * Always true.
+ * @deprecated Always true.
*/
@Deprecated
public static final boolean LOGD = true;
diff --git a/core/java/android/view/RawInputEvent.java b/core/java/android/view/RawInputEvent.java
index db024b4..8b3cdd4 100644
--- a/core/java/android/view/RawInputEvent.java
+++ b/core/java/android/view/RawInputEvent.java
@@ -171,6 +171,9 @@
public static final int ABS_MT_BLOB_ID = 0x38;
public static final int ABS_MAX = 0x3f;
+ // Switch events
+ public static final int SW_LID = 0x00;
+
public static final int SYN_REPORT = 0;
public static final int SYN_CONFIG = 1;
public static final int SYN_MT_REPORT = 2;
diff --git a/core/java/android/view/animation/Animation.java b/core/java/android/view/animation/Animation.java
index a662760..2f5e601 100644
--- a/core/java/android/view/animation/Animation.java
+++ b/core/java/android/view/animation/Animation.java
@@ -319,7 +319,7 @@
*
* @param durationMillis Duration in milliseconds
*
- * @throw java.lang.IllegalArgumentException if the duration is < 0
+ * @throws java.lang.IllegalArgumentException if the duration is < 0
*
* @attr ref android.R.styleable#Animation_duration
*/
diff --git a/core/java/android/webkit/BrowserFrame.java b/core/java/android/webkit/BrowserFrame.java
index afa2c35..ce27fd7f9 100644
--- a/core/java/android/webkit/BrowserFrame.java
+++ b/core/java/android/webkit/BrowserFrame.java
@@ -343,17 +343,16 @@
switch (msg.what) {
case FRAME_COMPLETED: {
if (mSettings.getSavePassword() && hasPasswordField()) {
- if (DebugFlags.BROWSER_FRAME) {
- Assert.assertNotNull(mCallbackProxy.getBackForwardList()
- .getCurrentItem());
- }
- WebAddress uri = new WebAddress(
- mCallbackProxy.getBackForwardList().getCurrentItem()
- .getUrl());
- String schemePlusHost = uri.mScheme + uri.mHost;
- String[] up = mDatabase.getUsernamePassword(schemePlusHost);
- if (up != null && up[0] != null) {
- setUsernamePassword(up[0], up[1]);
+ WebHistoryItem item = mCallbackProxy.getBackForwardList()
+ .getCurrentItem();
+ if (item != null) {
+ WebAddress uri = new WebAddress(item.getUrl());
+ String schemePlusHost = uri.mScheme + uri.mHost;
+ String[] up =
+ mDatabase.getUsernamePassword(schemePlusHost);
+ if (up != null && up[0] != null) {
+ setUsernamePassword(up[0], up[1]);
+ }
}
}
CacheManager.trimCacheIfNeeded();
diff --git a/core/java/android/webkit/CallbackProxy.java b/core/java/android/webkit/CallbackProxy.java
index e77d29b..6abf4c1 100644
--- a/core/java/android/webkit/CallbackProxy.java
+++ b/core/java/android/webkit/CallbackProxy.java
@@ -70,9 +70,6 @@
private final WebBackForwardList mBackForwardList;
// Used to call startActivity during url override.
private final Context mContext;
- // Stores the URL being loaded and the viewing mode to switch into when
- // the URL finishes loading.
- private ChangeViewModeOnFinishedLoad mChange;
// Message Ids
private static final int PAGE_STARTED = 100;
@@ -181,35 +178,15 @@
/**
* Tell the host application that the WebView has changed viewing modes.
- * @param toZoomedOut If true, the WebView has zoomed out so that the page
- * fits the screen. If false, it is zoomed to the setting
- * specified by the user.
+ * @param newViewingMode One of the values described in WebView as possible
+ * values for the viewing mode
*/
- /* package */ void uiOnChangeViewingMode(boolean toZoomOverview) {
+ /* package */ void uiOnChangeViewingMode(int newViewingMode) {
if (mWebChromeClient != null) {
- mWebChromeClient.onChangeViewingMode(toZoomOverview);
+ mWebChromeClient.onChangeViewingMode(mWebView, newViewingMode);
}
}
- private static class ChangeViewModeOnFinishedLoad {
- boolean mToZoomOverView;
- String mOriginalUrl;
- ChangeViewModeOnFinishedLoad(boolean toZoomOverview,
- String originalUrl) {
- mToZoomOverView = toZoomOverview;
- mOriginalUrl = originalUrl;
- }
- }
-
- /**
- * Keep track of the url and the viewing mode to change into. If/when that
- * url finishes loading, this will change the viewing mode.
- */
- /* package */ void uiChangeViewingModeOnFinishedLoad(
- boolean toZoomOverview, String originalUrl) {
- if (mWebChromeClient == null) return;
- mChange = new ChangeViewModeOnFinishedLoad(toZoomOverview, originalUrl);
- }
/**
* Called by the UI side. Calling overrideUrlLoading from the WebCore
* side will post a message to call this method.
@@ -271,15 +248,6 @@
if (mWebViewClient != null) {
mWebViewClient.onPageFinished(mWebView, (String) msg.obj);
}
- if (mChange != null) {
- if (mWebView.getOriginalUrl().equals(mChange.mOriginalUrl)) {
- uiOnChangeViewingMode(mChange.mToZoomOverView);
- } else {
- // The user has gone to a different page, so there is
- // no need to hang on to the old object.
- mChange = null;
- }
- }
break;
case RECEIVED_ICON:
diff --git a/core/java/android/webkit/ContentLoader.java b/core/java/android/webkit/ContentLoader.java
index f6d7f69..27cd6b5 100644
--- a/core/java/android/webkit/ContentLoader.java
+++ b/core/java/android/webkit/ContentLoader.java
@@ -105,8 +105,7 @@
if (mContentType != null) {
headers.setContentType("text/html");
}
- // override the cache-control header set by StreamLoader as content can
- // change, we don't want WebKit to cache it
+ // content can change, we don't want WebKit to cache it
headers.setCacheControl("no-store, no-cache");
}
diff --git a/core/java/android/webkit/LoadListener.java b/core/java/android/webkit/LoadListener.java
index 7fff014..43c76a8 100644
--- a/core/java/android/webkit/LoadListener.java
+++ b/core/java/android/webkit/LoadListener.java
@@ -99,6 +99,7 @@
private boolean mAuthFailed; // indicates that the prev. auth failed
private CacheLoader mCacheLoader;
private CacheManager.CacheResult mCacheResult;
+ private boolean mFromCache = false;
private HttpAuthHeader mAuthHeader;
private int mErrorID = OK;
private String mErrorDescription;
@@ -409,11 +410,10 @@
mStatusCode == HTTP_MOVED_PERMANENTLY ||
mStatusCode == HTTP_TEMPORARY_REDIRECT) &&
mNativeLoader != 0) {
- // Content arriving from a StreamLoader (eg File, Cache or Data)
- // will not be cached as they have the header:
- // cache-control: no-store
- mCacheResult = CacheManager.createCacheFile(mUrl, mStatusCode,
- headers, mMimeType, false);
+ if (!mFromCache && URLUtil.isNetworkUrl(mUrl)) {
+ mCacheResult = CacheManager.createCacheFile(mUrl, mStatusCode,
+ headers, mMimeType, false);
+ }
if (mCacheResult != null) {
mCacheResult.encoding = mEncoding;
}
@@ -626,6 +626,7 @@
* serviced by the Cache. */
/* package */ void setCacheLoader(CacheLoader c) {
mCacheLoader = c;
+ mFromCache = true;
}
/**
@@ -642,6 +643,8 @@
// Go ahead and set the cache loader to null in case the result is
// null.
mCacheLoader = null;
+ // reset the flag
+ mFromCache = false;
if (result != null) {
// The contents of the cache may need to be revalidated so just
@@ -662,6 +665,7 @@
}
// Load the cached file
mCacheLoader.load();
+ mFromCache = true;
return true;
}
}
@@ -681,6 +685,17 @@
" primary error: " + error.getPrimaryError() +
" certificate: " + error.getCertificate());
}
+ // Check the cached preference table before sending a message. This
+ // will prevent waiting for an already available answer.
+ if (Network.getInstance(mContext).checkSslPrefTable(this, error)) {
+ return true;
+ }
+ // Do not post a message for a synchronous request. This will cause a
+ // deadlock. Just bail on the request.
+ if (isSynchronous()) {
+ mRequestHandle.handleSslErrorResponse(false);
+ return true;
+ }
sendMessageInternal(obtainMessage(MSG_SSL_ERROR, error));
// if it has been canceled, return false so that the network thread
// won't be blocked. If it is not canceled, save the mRequestHandle
diff --git a/core/java/android/webkit/Network.java b/core/java/android/webkit/Network.java
index 0b9e596..af0cb1e 100644
--- a/core/java/android/webkit/Network.java
+++ b/core/java/android/webkit/Network.java
@@ -304,6 +304,14 @@
}
}
+ /* package */ boolean checkSslPrefTable(LoadListener loader,
+ SslError error) {
+ if (loader != null && error != null) {
+ return mSslErrorHandler.checkSslPrefTable(loader, error);
+ }
+ return false;
+ }
+
/**
* Handles authentication requests on their way up to the user (the user
* must provide credentials).
diff --git a/core/java/android/webkit/Plugin.java b/core/java/android/webkit/Plugin.java
index 302bea2..34a30a9 100644
--- a/core/java/android/webkit/Plugin.java
+++ b/core/java/android/webkit/Plugin.java
@@ -27,7 +27,7 @@
* Represents a plugin (Java equivalent of the PluginPackageAndroid
* C++ class in libs/WebKitLib/WebKit/WebCore/plugins/android/)
*
- * @deprecated This interface was inteded to be used by Gears. Since Gears was
+ * @deprecated This interface was intended to be used by Gears. Since Gears was
* deprecated, so is this class.
*/
@Deprecated
@@ -43,7 +43,8 @@
private PreferencesClickHandler mHandler;
/**
- * @deprecated
+ * @deprecated This interface was intended to be used by Gears. Since Gears was
+ * deprecated, so is this class.
*/
@Deprecated
public Plugin(String name,
@@ -58,7 +59,8 @@
}
/**
- * @deprecated
+ * @deprecated This interface was intended to be used by Gears. Since Gears was
+ * deprecated, so is this class.
*/
@Deprecated
public String toString() {
@@ -66,7 +68,8 @@
}
/**
- * @deprecated
+ * @deprecated This interface was intended to be used by Gears. Since Gears was
+ * deprecated, so is this class.
*/
@Deprecated
public String getName() {
@@ -74,7 +77,8 @@
}
/**
- * @deprecated
+ * @deprecated This interface was intended to be used by Gears. Since Gears was
+ * deprecated, so is this class.
*/
@Deprecated
public String getPath() {
@@ -82,7 +86,8 @@
}
/**
- * @deprecated
+ * @deprecated This interface was intended to be used by Gears. Since Gears was
+ * deprecated, so is this class.
*/
@Deprecated
public String getFileName() {
@@ -90,7 +95,8 @@
}
/**
- * @deprecated
+ * @deprecated This interface was intended to be used by Gears. Since Gears was
+ * deprecated, so is this class.
*/
@Deprecated
public String getDescription() {
@@ -98,7 +104,8 @@
}
/**
- * @deprecated
+ * @deprecated This interface was intended to be used by Gears. Since Gears was
+ * deprecated, so is this class.
*/
@Deprecated
public void setName(String name) {
@@ -106,7 +113,8 @@
}
/**
- * @deprecated
+ * @deprecated This interface was intended to be used by Gears. Since Gears was
+ * deprecated, so is this class.
*/
@Deprecated
public void setPath(String path) {
@@ -114,7 +122,8 @@
}
/**
- * @deprecated
+ * @deprecated This interface was intended to be used by Gears. Since Gears was
+ * deprecated, so is this class.
*/
@Deprecated
public void setFileName(String fileName) {
@@ -122,7 +131,8 @@
}
/**
- * @deprecated
+ * @deprecated This interface was intended to be used by Gears. Since Gears was
+ * deprecated, so is this class.
*/
@Deprecated
public void setDescription(String description) {
@@ -130,7 +140,8 @@
}
/**
- * @deprecated
+ * @deprecated This interface was intended to be used by Gears. Since Gears was
+ * deprecated, so is this class.
*/
@Deprecated
public void setClickHandler(PreferencesClickHandler handler) {
@@ -140,7 +151,8 @@
/**
* Invokes the click handler for this plugin.
*
- * @deprecated
+ * @deprecated This interface was intended to be used by Gears. Since Gears was
+ * deprecated, so is this class.
*/
@Deprecated
public void dispatchClickEvent(Context context) {
@@ -152,7 +164,8 @@
/**
* Default click handler. The plugins should implement their own.
*
- * @deprecated
+ * @deprecated This interface was intended to be used by Gears. Since Gears was
+ * deprecated, so is this class.
*/
@Deprecated
private class DefaultClickHandler implements PreferencesClickHandler,
@@ -172,7 +185,8 @@
}
}
/**
- * @deprecated
+ * @deprecated This interface was intended to be used by Gears. Since Gears was
+ * deprecated, so is this class.
*/
@Deprecated
public void onClick(DialogInterface dialog, int which) {
diff --git a/core/java/android/webkit/PluginData.java b/core/java/android/webkit/PluginData.java
index d9b196a..2dd445e 100644
--- a/core/java/android/webkit/PluginData.java
+++ b/core/java/android/webkit/PluginData.java
@@ -28,7 +28,7 @@
* status code. The PluginData class is the container for all these
* parts.
*
- * @deprecated This class was inteded to be used by Gears. Since Gears was
+ * @deprecated This class was intended to be used by Gears. Since Gears was
* deprecated, so is this class.
*/
@Deprecated
@@ -63,7 +63,8 @@
* lowercase header name to [ unmodified header name, header value]
* @param length The HTTP response status code.
*
- * @deprecated
+ * @deprecated This class was intended to be used by Gears. Since Gears was
+ * deprecated, so is this class.
*/
@Deprecated
public PluginData(
@@ -82,7 +83,8 @@
*
* @return An InputStream instance with the plugin content.
*
- * @deprecated
+ * @deprecated This class was intended to be used by Gears. Since Gears was
+ * deprecated, so is this class.
*/
@Deprecated
public InputStream getInputStream() {
@@ -94,7 +96,8 @@
*
* @return the length of the plugin content.
*
- * @deprecated
+ * @deprecated This class was intended to be used by Gears. Since Gears was
+ * deprecated, so is this class.
*/
@Deprecated
public long getContentLength() {
@@ -109,7 +112,8 @@
* mapping is 'lowercase header name' to ['unmodified header
* name', header value].
*
- * @deprecated
+ * @deprecated This class was intended to be used by Gears. Since Gears was
+ * deprecated, so is this class.
*/
@Deprecated
public Map<String, String[]> getHeaders() {
@@ -121,7 +125,8 @@
*
* @return The HTTP statue code, e.g 200.
*
- * @deprecated
+ * @deprecated This class was intended to be used by Gears. Since Gears was
+ * deprecated, so is this class.
*/
@Deprecated
public int getStatusCode() {
diff --git a/core/java/android/webkit/PluginList.java b/core/java/android/webkit/PluginList.java
index 5b65b9a..a61b07b 100644
--- a/core/java/android/webkit/PluginList.java
+++ b/core/java/android/webkit/PluginList.java
@@ -25,7 +25,7 @@
* populated when the plugins are initialized (at
* browser startup, at the moment).
*
- * @deprecated This interface was inteded to be used by Gears. Since Gears was
+ * @deprecated This interface was intended to be used by Gears. Since Gears was
* deprecated, so is this class.
*/
@Deprecated
@@ -35,7 +35,8 @@
/**
* Public constructor. Initializes the list of plugins.
*
- * @deprecated
+ * @deprecated This interface was intended to be used by Gears. Since Gears was
+ * deprecated, so is this class.
*/
@Deprecated
public PluginList() {
@@ -45,7 +46,8 @@
/**
* Returns the list of plugins as a java.util.List.
*
- * @deprecated
+ * @deprecated This interface was intended to be used by Gears. Since Gears was
+ * deprecated, so is this class.
*/
@Deprecated
public synchronized List getList() {
@@ -55,7 +57,8 @@
/**
* Adds a plugin to the list.
*
- * @deprecated
+ * @deprecated This interface was intended to be used by Gears. Since Gears was
+ * deprecated, so is this class.
*/
@Deprecated
public synchronized void addPlugin(Plugin plugin) {
@@ -67,7 +70,8 @@
/**
* Removes a plugin from the list.
*
- * @deprecated
+ * @deprecated This interface was intended to be used by Gears. Since Gears was
+ * deprecated, so is this class.
*/
@Deprecated
public synchronized void removePlugin(Plugin plugin) {
@@ -80,7 +84,8 @@
/**
* Clears the plugin list.
*
- * @deprecated
+ * @deprecated This interface was intended to be used by Gears. Since Gears was
+ * deprecated, so is this class.
*/
@Deprecated
public synchronized void clear() {
@@ -90,7 +95,8 @@
/**
* Dispatches the click event to the appropriate plugin.
*
- * @deprecated
+ * @deprecated This interface was intended to be used by Gears. Since Gears was
+ * deprecated, so is this class.
*/
@Deprecated
public synchronized void pluginClicked(Context context, int position) {
diff --git a/core/java/android/webkit/SslErrorHandler.java b/core/java/android/webkit/SslErrorHandler.java
index 5011244..90ed65d 100644
--- a/core/java/android/webkit/SslErrorHandler.java
+++ b/core/java/android/webkit/SslErrorHandler.java
@@ -58,7 +58,9 @@
public void handleMessage(Message msg) {
switch (msg.what) {
case HANDLE_RESPONSE:
- handleSslErrorResponse(msg.arg1 == 1);
+ LoadListener loader = (LoadListener) msg.obj;
+ handleSslErrorResponse(loader, loader.sslError(),
+ msg.arg1 == 1);
fastProcessQueuedSslErrors();
break;
}
@@ -76,7 +78,7 @@
* Saves this handler's state into a map.
* @return True iff succeeds.
*/
- /* package */ boolean saveState(Bundle outState) {
+ /* package */ synchronized boolean saveState(Bundle outState) {
boolean success = (outState != null);
if (success) {
// TODO?
@@ -90,7 +92,7 @@
* Restores this handler's state from a map.
* @return True iff succeeds.
*/
- /* package */ boolean restoreState(Bundle inState) {
+ /* package */ synchronized boolean restoreState(Bundle inState) {
boolean success = (inState != null);
if (success) {
success = inState.containsKey("ssl-error-handler");
@@ -127,6 +129,28 @@
}
/**
+ * Check the preference table for a ssl error that has already been shown
+ * to the user.
+ */
+ /* package */ synchronized boolean checkSslPrefTable(LoadListener loader,
+ SslError error) {
+ final String host = loader.host();
+ final int primary = error.getPrimaryError();
+
+ if (DebugFlags.SSL_ERROR_HANDLER) {
+ Assert.assertTrue(host != null && primary != 0);
+ }
+
+ if (mSslPrefTable.containsKey(host)) {
+ if (primary <= mSslPrefTable.getInt(host)) {
+ handleSslErrorResponse(loader, error, true);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
* Processes queued SSL-error confirmation requests in
* a tight loop while there is no need to ask the user.
*/
@@ -144,7 +168,9 @@
if (loader != null) {
// if this loader has been cancelled
if (loader.cancelled()) {
- // go to the following loader in the queue
+ // go to the following loader in the queue. Make sure this
+ // loader has been removed from the queue.
+ mLoaderQueue.remove(loader);
return true;
}
@@ -154,18 +180,12 @@
Assert.assertNotNull(error);
}
- int primary = error.getPrimaryError();
- String host = loader.host();
-
- if (DebugFlags.SSL_ERROR_HANDLER) {
- Assert.assertTrue(host != null && primary != 0);
- }
-
- if (mSslPrefTable.containsKey(host)) {
- if (primary <= mSslPrefTable.getInt(host)) {
- handleSslErrorResponse(true);
- return true;
- }
+ // checkSslPrefTable will handle the ssl error response if the
+ // answer is available. It does not remove the loader from the
+ // queue.
+ if (checkSslPrefTable(loader, error)) {
+ mLoaderQueue.remove(loader);
+ return true;
}
// if we do not have information on record, ask
@@ -182,7 +202,7 @@
* Proceed with the SSL certificate.
*/
public void proceed() {
- sendMessage(obtainMessage(HANDLE_RESPONSE, 1, 0));
+ sendMessage(obtainMessage(HANDLE_RESPONSE, 1, 0, mLoaderQueue.poll()));
}
/**
@@ -190,16 +210,17 @@
* the error.
*/
public void cancel() {
- sendMessage(obtainMessage(HANDLE_RESPONSE, 0, 0));
+ sendMessage(obtainMessage(HANDLE_RESPONSE, 0, 0, mLoaderQueue.poll()));
}
/**
* Handles SSL error(s) on the way down from the user.
*/
- /* package */ synchronized void handleSslErrorResponse(boolean proceed) {
- LoadListener loader = mLoaderQueue.poll();
+ /* package */ synchronized void handleSslErrorResponse(LoadListener loader,
+ SslError error, boolean proceed) {
if (DebugFlags.SSL_ERROR_HANDLER) {
Assert.assertNotNull(loader);
+ Assert.assertNotNull(error);
}
if (DebugFlags.SSL_ERROR_HANDLER) {
@@ -211,7 +232,7 @@
if (!loader.cancelled()) {
if (proceed) {
// update the user's SSL error preference table
- int primary = loader.sslError().getPrimaryError();
+ int primary = error.getPrimaryError();
String host = loader.host();
if (DebugFlags.SSL_ERROR_HANDLER) {
diff --git a/core/java/android/webkit/StreamLoader.java b/core/java/android/webkit/StreamLoader.java
index eab3350..623ff29 100644
--- a/core/java/android/webkit/StreamLoader.java
+++ b/core/java/android/webkit/StreamLoader.java
@@ -157,7 +157,6 @@
if (mContentLength > 0) {
headers.setContentLength(mContentLength);
}
- headers.setCacheControl(NO_STORE);
buildHeaders(headers);
mHandler.headers(headers);
}
diff --git a/core/java/android/webkit/URLUtil.java b/core/java/android/webkit/URLUtil.java
index 5ed42e9..232ed36 100644
--- a/core/java/android/webkit/URLUtil.java
+++ b/core/java/android/webkit/URLUtil.java
@@ -172,6 +172,7 @@
* requests from a file url.
* @deprecated Cookieless proxy is no longer supported.
*/
+ @Deprecated
public static boolean isCookielessProxyUrl(String url) {
return (null != url) && url.startsWith(PROXY_BASE);
}
diff --git a/core/java/android/webkit/UrlInterceptRegistry.java b/core/java/android/webkit/UrlInterceptRegistry.java
index 6e2a482..eca5acd 100644
--- a/core/java/android/webkit/UrlInterceptRegistry.java
+++ b/core/java/android/webkit/UrlInterceptRegistry.java
@@ -25,7 +25,7 @@
import java.util.Map;
/**
- * @deprecated This class was inteded to be used by Gears. Since Gears was
+ * @deprecated This class was intended to be used by Gears. Since Gears was
* deprecated, so is this class.
*/
@Deprecated
@@ -48,7 +48,8 @@
*
* @param disabled true to disable the cache
*
- * @deprecated
+ * @deprecated This class was intended to be used by Gears. Since Gears was
+ * deprecated, so is this class.
*/
@Deprecated
public static synchronized void setUrlInterceptDisabled(boolean disabled) {
@@ -60,7 +61,8 @@
*
* @return return if it is disabled
*
- * @deprecated
+ * @deprecated This class was intended to be used by Gears. Since Gears was
+ * deprecated, so is this class.
*/
@Deprecated
public static synchronized boolean urlInterceptDisabled() {
@@ -74,7 +76,8 @@
* @param handler The new UrlInterceptHandler object
* @return true if the handler was not previously registered.
*
- * @deprecated
+ * @deprecated This class was intended to be used by Gears. Since Gears was
+ * deprecated, so is this class.
*/
@Deprecated
public static synchronized boolean registerHandler(
@@ -93,7 +96,8 @@
* @param handler A previously registered UrlInterceptHandler.
* @return true if the handler was found and removed from the list.
*
- * @deprecated
+ * @deprecated This class was intended to be used by Gears. Since Gears was
+ * deprecated, so is this class.
*/
@Deprecated
public static synchronized boolean unregisterHandler(
@@ -107,7 +111,8 @@
*
* @return A CacheResult containing surrogate content.
*
- * @deprecated
+ * @deprecated This class was intended to be used by Gears. Since Gears was
+ * deprecated, so is this class.
*/
@Deprecated
public static synchronized CacheResult getSurrogate(
@@ -133,7 +138,8 @@
*
* @return A PluginData instance containing surrogate content.
*
- * @deprecated
+ * @deprecated This class was intended to be used by Gears. Since Gears was
+ * deprecated, so is this class.
*/
@Deprecated
public static synchronized PluginData getPluginData(
diff --git a/core/java/android/webkit/WebChromeClient.java b/core/java/android/webkit/WebChromeClient.java
index e1c8d4d..e2d5d24 100644
--- a/core/java/android/webkit/WebChromeClient.java
+++ b/core/java/android/webkit/WebChromeClient.java
@@ -24,12 +24,12 @@
/**
* Tell the host application that the WebView has changed viewing modes.
- * @param toZoomedOut If true, the WebView has zoomed out so that the page
- * fits the screen. If false, it is zoomed to the setting
- * specified by the user.
+ * @param view The WebView that initiated the callback.
+ * @param newViewingMode One of the values described in WebView as possible
+ * values for the viewing mode
* @hide
*/
- public void onChangeViewingMode(boolean toZoomedOut) {}
+ public void onChangeViewingMode(WebView view, int newViewingMode) {}
/**
* Tell the host application the current progress of loading a page.
diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java
index eeac1d2..e8b2702 100644
--- a/core/java/android/webkit/WebSettings.java
+++ b/core/java/android/webkit/WebSettings.java
@@ -167,10 +167,12 @@
private boolean mDatabaseEnabled = false;
private boolean mDomStorageEnabled = false;
private boolean mWorkersEnabled = false; // only affects V8.
+ private boolean mGeolocationEnabled = false;
// HTML5 configuration parameters
private long mAppCacheMaxSize = Long.MAX_VALUE;
private String mAppCachePath = "";
private String mDatabasePath = "";
+ private String mGeolocationDatabasePath = "";
// Don't need to synchronize the get/set methods as they
// are basic types, also none of these values are used in
// native WebCore code.
@@ -977,6 +979,21 @@
}
/**
+ * Set the path where the Geolocation permissions database should be saved.
+ * This will update WebCore when the Sync runs in the C++ side.
+ * @param databasePath String path to the directory where the Geolocation
+ * permissions database should be saved. May be the empty string but
+ * should never be null.
+ * @hide pending api council approval
+ */
+ public synchronized void setGeolocationDatabasePath(String databasePath) {
+ if (databasePath != null && !databasePath.equals(mDatabasePath)) {
+ mGeolocationDatabasePath = databasePath;
+ postSync();
+ }
+ }
+
+ /**
* Tell the WebView to enable Application Caches API.
* @param flag True if the WebView should enable Application Caches.
* @hide pending api council approval
@@ -1082,6 +1099,18 @@
}
/**
+ * Sets whether Geolocation is enabled.
+ * @param flag Whether Geolocation should be enabled.
+ * @hide pending api council approval
+ */
+ public synchronized void setGeolocationEnabled(boolean flag) {
+ if (mGeolocationEnabled != flag) {
+ mGeolocationEnabled = flag;
+ postSync();
+ }
+ }
+
+ /**
* Return true if javascript is enabled. <b>Note: The default is false.</b>
* @return True if javascript is enabled.
*/
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index f49aab1..196c66b 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -522,6 +522,48 @@
// the last zoom scale.
boolean mInZoomOverview = false;
+ // The viewing mode of this webview. Reported back to the WebChromeClient
+ // so we can hide and display the title bar as appropriate.
+ private int mViewingMode;
+ /**
+ * Not supporting overview vs reading mode
+ * @hide
+ */
+ public final static int NO_VIEWING_MODE = 0;
+ /**
+ * Zoom overview mode. The page is zoomed all the way out, mInZoomOverview
+ * is true, and the title bar is showing. Double tapping will change to
+ * reading mode.
+ * @hide
+ */
+ public final static int OVERVIEW_MODE = 1;
+ /**
+ * Reading mode. The page is at the level specified by the user,
+ * mInZoomOverview is false, and the title bar is not showing. Double
+ * tapping will change to zoom overview mode.
+ * @hide
+ */
+ public final static int READING_MODE = 2;
+ /**
+ * Modified reading mode, which shows the title bar. mInZoomOverview is
+ * false, and double tapping will change to zoom overview mode. However,
+ * if the scrolling will change to reading mode. Used when swiping a
+ * tab into view which was in reading mode, unless it was a mobile site
+ * with zero scroll.
+ * @hide
+ */
+ public final static int READING_MODE_WITH_TITLE_BAR = 3;
+ /**
+ * Another modified reading mode. For loading a mobile site, or swiping a
+ * tab into view which was displaying a mobile site in reading mode
+ * with zero scroll
+ * @hide
+ */
+ public final static int TITLE_BAR_DISMISS_MODE = 4;
+ // Whether the current site is a mobile site. Determined when we receive
+ // NEW_PICTURE_MSG_ID to help determine how to handle double taps
+ private boolean mMobileSite;
+
// ideally mZoomOverviewWidth should be mContentWidth. But sites like espn,
// engadget always have wider mContentWidth no matter what viewport size is.
int mZoomOverviewWidth = WebViewCore.DEFAULT_VIEWPORT_WIDTH;
@@ -1135,6 +1177,7 @@
if (mInZoomOverview) {
b.putFloat("lastScale", mLastScale);
}
+ b.putBoolean("mobile", mMobileSite);
return true;
}
return false;
@@ -1180,12 +1223,20 @@
// correctly
mActualScale = scale;
float lastScale = b.getFloat("lastScale", -1.0f);
+ mMobileSite = b.getBoolean("mobile", false);
if (lastScale > 0) {
mInZoomOverview = true;
+ mViewingMode = OVERVIEW_MODE;
mLastScale = lastScale;
} else {
mInZoomOverview = false;
+ if (mMobileSite && (mScrollX | mScrollY) == 0) {
+ mViewingMode = TITLE_BAR_DISMISS_MODE;
+ } else {
+ mViewingMode = READING_MODE_WITH_TITLE_BAR;
+ }
}
+ mCallbackProxy.uiOnChangeViewingMode(mViewingMode);
invalidate();
return true;
}
@@ -3674,8 +3725,10 @@
protected void onSizeChanged(int w, int h, int ow, int oh) {
super.onSizeChanged(w, h, ow, oh);
// Center zooming to the center of the screen.
- mZoomCenterX = getViewWidth() * .5f;
- mZoomCenterY = getViewHeight() * .5f;
+ if (mZoomScale == 0) { // unless we're already zooming
+ mZoomCenterX = getViewWidth() * .5f;
+ mZoomCenterY = getViewHeight() * .5f;
+ }
// update mMinZoomScale if the minimum zoom scale is not fixed
if (!mMinZoomScaleFixed) {
@@ -3693,6 +3746,12 @@
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
super.onScrollChanged(l, t, oldl, oldt);
+ if (mViewingMode == READING_MODE_WITH_TITLE_BAR
+ || mViewingMode == TITLE_BAR_DISMISS_MODE) {
+ mViewingMode = READING_MODE;
+ mCallbackProxy.uiOnChangeViewingMode(mViewingMode);
+ }
+
sendOurVisibleRect();
}
@@ -3907,6 +3966,13 @@
deltaY = newScrollY - mScrollY;
boolean done = false;
if (deltaX == 0 && deltaY == 0) {
+ // The user attempted to pan the page, so dismiss the title
+ // bar
+ if (mViewingMode == READING_MODE_WITH_TITLE_BAR
+ || mViewingMode == TITLE_BAR_DISMISS_MODE) {
+ mViewingMode = READING_MODE;
+ mCallbackProxy.uiOnChangeViewingMode(mViewingMode);
+ }
done = true;
} else {
if (mSnapScrollMode == SNAP_X || mSnapScrollMode == SNAP_Y) {
@@ -4681,14 +4747,42 @@
}
}
+ /**
+ * Called when the Tabs are used to slide this WebView's tab into view.
+ * @hide
+ */
+ public void slideIntoFocus() {
+ if (mViewingMode == READING_MODE) {
+ if (!mMobileSite || (mScrollX | mScrollY) != 0) {
+ mViewingMode = READING_MODE_WITH_TITLE_BAR;
+ } else {
+ mViewingMode = TITLE_BAR_DISMISS_MODE;
+ }
+ mCallbackProxy.uiOnChangeViewingMode(mViewingMode);
+ }
+ }
+
private void doDoubleTap() {
- if (mWebViewCore.getSettings().getUseWideViewPort() == false) {
+ if (mWebViewCore.getSettings().getUseWideViewPort() == false ||
+ mViewingMode == NO_VIEWING_MODE) {
return;
}
+ if (mViewingMode == TITLE_BAR_DISMISS_MODE) {
+ mViewingMode = READING_MODE;
+ // mInZoomOverview will not change, so change the viewing mode
+ // and return
+ mCallbackProxy.uiOnChangeViewingMode(mViewingMode);
+ return;
+ }
+ if (mViewingMode == READING_MODE_WITH_TITLE_BAR && mMobileSite) {
+ scrollTo(0,0);
+ }
+ // READING_MODE_WITH_TITLE_BAR will go to OVERVIEW_MODE here.
mZoomCenterX = mLastTouchX;
mZoomCenterY = mLastTouchY;
mInZoomOverview = !mInZoomOverview;
- mCallbackProxy.uiOnChangeViewingMode(mInZoomOverview);
+ mViewingMode = mInZoomOverview ? OVERVIEW_MODE : READING_MODE;
+ mCallbackProxy.uiOnChangeViewingMode(mViewingMode);
// remove the zoom control after double tap
if (getSettings().getBuiltInZoomControls()) {
if (mZoomButtonsController.isVisible()) {
@@ -5033,21 +5127,27 @@
} else {
mMaxZoomScale = restoreState.mMaxScale;
}
- if (useWideViewport && restoreState.mViewScale == 0) {
- mInZoomOverview = ENABLE_DOUBLETAP_ZOOM
- && settings.getLoadWithOverviewMode();
- }
- mCallbackProxy.uiOnChangeViewingMode(true);
- if (!mInZoomOverview) {
- // We are going to start zoomed in. However, we
- // truly want to show the title bar, and then hide
- // it once the page has loaded
- mCallbackProxy.uiChangeViewingModeOnFinishedLoad(
- false, getOriginalUrl());
- }
setNewZoomScale(mLastScale, false);
setContentScrollTo(restoreState.mScrollX,
restoreState.mScrollY);
+ if (!ENABLE_DOUBLETAP_ZOOM
+ || !settings.getLoadWithOverviewMode()) {
+ mMobileSite = false;
+ mViewingMode = NO_VIEWING_MODE;
+ } else {
+ mMobileSite = restoreState.mMobileSite;
+ if (useWideViewport
+ && restoreState.mViewScale == 0) {
+ mViewingMode = OVERVIEW_MODE;
+ mInZoomOverview = true;
+ } else if (mMobileSite
+ && (mScrollX | mScrollY) == 0) {
+ mViewingMode = TITLE_BAR_DISMISS_MODE;
+ } else {
+ mViewingMode = READING_MODE_WITH_TITLE_BAR;
+ }
+ }
+ mCallbackProxy.uiOnChangeViewingMode(mViewingMode);
// As we are on a new page, remove the WebTextView. This
// is necessary for page loads driven by webkit, and in
// particular when the user was on a password field, so
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index dee62b4..d6a9cff 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -1505,6 +1505,7 @@
float mTextWrapScale;
int mScrollX;
int mScrollY;
+ boolean mMobileSite;
}
static class DrawData {
@@ -1859,6 +1860,7 @@
mRestoreState.mMaxScale = mViewportMaximumScale / 100.0f;
mRestoreState.mScrollX = mRestoredX;
mRestoreState.mScrollY = mRestoredY;
+ mRestoreState.mMobileSite = (0 == mViewportWidth);
if (mRestoredScale > 0) {
if (mRestoredScreenWidthScale > 0) {
mRestoreState.mTextWrapScale =
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index e0a268e..a611d5a 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -7222,6 +7222,7 @@
if (word != null) {
Intent i = new Intent("com.android.settings.USER_DICTIONARY_INSERT");
i.putExtra("word", word);
+ i.setFlags(i.getFlags() | Intent.FLAG_ACTIVITY_NEW_TASK);
getContext().startActivity(i);
}
diff --git a/core/java/com/android/internal/service/wallpaper/ImageWallpaper.java b/core/java/com/android/internal/service/wallpaper/ImageWallpaper.java
index 3f2979f..c4eb31f 100644
--- a/core/java/com/android/internal/service/wallpaper/ImageWallpaper.java
+++ b/core/java/com/android/internal/service/wallpaper/ImageWallpaper.java
@@ -21,7 +21,6 @@
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.service.wallpaper.WallpaperService;
-import android.util.Log;
import android.view.MotionEvent;
import android.view.SurfaceHolder;
import android.content.Context;
@@ -87,14 +86,13 @@
@Override
public void onTouchEvent(MotionEvent event) {
super.onTouchEvent(event);
- Log.i("foo", "Touch event: " + event);
}
@Override
public void onOffsetsChanged(float xOffset, float yOffset,
int xPixels, int yPixels) {
mXOffset = xOffset;
- mYOffset = xOffset;
+ mYOffset = yOffset;
drawFrame();
}
@@ -128,9 +126,9 @@
final int availw = bw-dw;
final int availh = bh-dh;
int xPixels = availw > 0
- ? -(int)(availw*mXOffset+.5f) : -(int)(availw/2);
+ ? -(int)(availw*mXOffset+.5f) : -(availw/2);
int yPixels = availh > 0
- ? -(int)(availh*mYOffset+.5f) : -(int)(availh/2);
+ ? -(int)(availh*mYOffset+.5f) : -(availh/2);
c.translate(xPixels, yPixels);
c.drawColor(0xff000000);
background.draw(c);
diff --git a/core/java/com/android/internal/widget/ContactHeaderWidget.java b/core/java/com/android/internal/widget/ContactHeaderWidget.java
index 70f2779..9e487776 100644
--- a/core/java/com/android/internal/widget/ContactHeaderWidget.java
+++ b/core/java/com/android/internal/widget/ContactHeaderWidget.java
@@ -80,6 +80,8 @@
protected Uri mContactUri;
protected Uri mStatusUri;
+ protected String[] mExcludeMimes = null;
+
protected ContentResolver mContentResolver;
/**
@@ -292,6 +294,15 @@
}
/**
+ * Set a list of specific MIME-types to exclude and not display. For
+ * example, this can be used to hide the {@link Contacts#CONTENT_ITEM_TYPE}
+ * profile icon.
+ */
+ public void setExcludeMimes(String[] excludeMimes) {
+ mExcludeMimes = excludeMimes;
+ }
+
+ /**
* Convenience method for binding all available data from an existing
* contact.
*
@@ -428,6 +439,10 @@
final Rect target = getTargetRect(view);
intent.putExtra(Intents.EXTRA_TARGET_RECT, target);
intent.putExtra(Intents.EXTRA_MODE, Intents.MODE_SMALL);
+ if (mExcludeMimes != null) {
+ // Exclude specific MIME-types when requested
+ intent.putExtra(Intents.EXTRA_EXCLUDE_MIMES, mExcludeMimes);
+ }
mContext.startActivity(intent);
break;
}
diff --git a/core/java/com/google/android/mms/pdu/PduPersister.java b/core/java/com/google/android/mms/pdu/PduPersister.java
index 74af7650..df91ea6 100644
--- a/core/java/com/google/android/mms/pdu/PduPersister.java
+++ b/core/java/com/google/android/mms/pdu/PduPersister.java
@@ -1021,6 +1021,7 @@
+ "content://mms/drafts, content://mms/outbox, "
+ "content://mms/temp.");
}
+ PDU_CACHE_INSTANCE.purge(uri);
PduHeaders header = pdu.getPduHeaders();
PduBody body = null;
diff --git a/core/res/res/drawable/stat_sys_data_connected_h.png b/core/res/res/drawable/stat_sys_data_connected_h.png
new file mode 100644
index 0000000..7d5413a
--- /dev/null
+++ b/core/res/res/drawable/stat_sys_data_connected_h.png
Binary files differ
diff --git a/core/res/res/drawable/stat_sys_data_in_h.png b/core/res/res/drawable/stat_sys_data_in_h.png
new file mode 100644
index 0000000..695b80c
--- /dev/null
+++ b/core/res/res/drawable/stat_sys_data_in_h.png
Binary files differ
diff --git a/core/res/res/drawable/stat_sys_data_inandout_h.png b/core/res/res/drawable/stat_sys_data_inandout_h.png
new file mode 100644
index 0000000..467acd1
--- /dev/null
+++ b/core/res/res/drawable/stat_sys_data_inandout_h.png
Binary files differ
diff --git a/core/res/res/drawable/stat_sys_data_out_h.png b/core/res/res/drawable/stat_sys_data_out_h.png
new file mode 100644
index 0000000..da50305
--- /dev/null
+++ b/core/res/res/drawable/stat_sys_data_out_h.png
Binary files differ
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 729b1db..cd3f065 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -2274,6 +2274,10 @@
of the states. If false, the size will vary based on the
current state. -->
<attr name="constantSize" format="boolean" />
+ <!-- Enables or disables dithering of the bitmap if the bitmap does not have the
+ same pixel configuration as the screen (for instance: a ARGB 8888 bitmap with
+ an RGB 565 screen.) -->
+ <attr name="dither" format="boolean" />
</declare-styleable>
<declare-styleable name="AnimationDrawable">
@@ -2420,7 +2424,7 @@
<!-- Enables or disables dithering of the bitmap if the bitmap does not have the
same pixel configuration as the screen (for instance: a ARGB 8888 bitmap with
an RGB 565 screen.) -->
- <attr name="dither" format="boolean" />
+ <attr name="dither" />
<!-- Defines the gravity for the bitmap. The gravity indicates where to position
the drawable in its container if the bitmap is smaller than the container. -->
<attr name="gravity" />
@@ -2920,16 +2924,16 @@
when the user clicks a suggestion. <i>Optional attribute.</i> -->
<attr name="searchSuggestIntentData" format="string" />
- <!-- If provided, this is the minimum number of characters needed to trigger
+ <!-- @hide If provided, this is the minimum number of characters needed to trigger
search suggestions. The default value is 0. <i>Optional attribute.</i> -->
<attr name="searchSuggestThreshold" format="integer" />
- <!-- If provided and <code>true</code>, this searchable activity will be
+ <!-- @hide If provided and <code>true</code>, this searchable activity will be
included in any global lists of search targets.
- The default value is <code>false</code>. <i>Optional attribute.</i>. -->
+ The default value is <code>false</code>. <i>Optional attribute.</i>.-->
<attr name="includeInGlobalSearch" format="boolean" />
- <!-- If provided and <code>true</code>, this searchable activity will be invoked for all
+ <!-- @hide If provided and <code>true</code>, this searchable activity will be invoked for all
queries in a particular session. If set to <code>false</code> and the activity
returned zero results for a query, it will not be invoked again in that session for
supersets of that zero-results query. For example, if the activity returned zero
@@ -2937,7 +2941,7 @@
The default value is <code>false</code>. <i>Optional attribute.</i>. -->
<attr name="queryAfterZeroResults" format="boolean" />
- <!-- If provided, this string will be used to describe the searchable item in the
+ <!-- @hide If provided, this string will be used to describe the searchable item in the
searchable items settings within system search settings. <i>Optional
attribute.</i> -->
<attr name="searchSettingsDescription" format="string" />
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 92c776c..f6595ce 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -57,4 +57,10 @@
<item>"wifi,1,1"</item>
<item>"mobile,0,1"</item>
</string-array>
+
+ <!-- The number of degrees to rotate the display when the keyboard is open. -->
+ <integer name="config_lidOpenRotation">90</integer>
+
+ <!-- The number of degrees to rotate the display when the device is in a dock. -->
+ <integer name="config_dockedRotation">90</integer>
</resources>
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 4bc376b..5f1c3c3 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1094,7 +1094,9 @@
<public type="attr" name="tension" id="0x0101026a" />
<public type="attr" name="extraTension" id="0x0101026b" />
<public type="attr" name="anyDensity" id="0x0101026c" />
+ <!-- {@hide} -->
<public type="attr" name="searchSuggestThreshold" id="0x0101026d" />
+ <!-- {@hide} -->
<public type="attr" name="includeInGlobalSearch" id="0x0101026e" />
<public type="attr" name="onClick" id="0x0101026f" />
<public type="attr" name="targetSdkVersion" id="0x01010270" />
@@ -1115,6 +1117,7 @@
<public type="attr" name="backupAgent" id="0x0101027f" />
<public type="attr" name="allowBackup" id="0x01010280" />
<public type="attr" name="glEsVersion" id="0x01010281" />
+ <!-- {@hide} -->
<public type="attr" name="queryAfterZeroResults" id="0x01010282" />
<public type="attr" name="dropDownHeight" id="0x01010283" />
<public type="attr" name="smallScreens" id="0x01010284" />
@@ -1123,6 +1126,7 @@
<public type="attr" name="progressBarStyleInverse" id="0x01010287" />
<public type="attr" name="progressBarStyleSmallInverse" id="0x01010288" />
<public type="attr" name="progressBarStyleLargeInverse" id="0x01010289" />
+ <!-- {@hide} -->
<public type="attr" name="searchSettingsDescription" id="0x0101028a" />
<public type="attr" name="textColorPrimaryInverseDisableOnly" id="0x0101028b" />
<public type="attr" name="autoUrlDetect" id="0x0101028c" />
diff --git a/data/etc/platform.xml b/data/etc/platform.xml
index 20aa6e7..7322e6c 100644
--- a/data/etc/platform.xml
+++ b/data/etc/platform.xml
@@ -146,8 +146,6 @@
<library name="android.test.runner"
file="/system/framework/android.test.runner.jar" />
- <library name="com.android.im.plugin"
- file="/system/framework/com.android.im.plugin.jar"/>
<library name="javax.obex"
file="/system/framework/javax.obex.jar"/>
diff --git a/docs/html/guide/guide_toc.cs b/docs/html/guide/guide_toc.cs
index 0b33739..459ad37 100644
--- a/docs/html/guide/guide_toc.cs
+++ b/docs/html/guide/guide_toc.cs
@@ -387,17 +387,30 @@
<li><a href="<?cs var:toroot ?>guide/samples/ApiDemos/index.html">
<span class="en">API Demos</span>
</a></li>
+ <li><a href="<?cs var:toroot ?>guide/samples/Home/index.html">
+ <span class="en">Home</span>
+ </a></li>
+ <li><a href="<?cs var:toroot ?>guide/samples/JetBoy/index.html">
+ <span class="en">JetBoy</span>
+ </a></li>
<li><a href="<?cs var:toroot ?>guide/samples/LunarLander/index.html">
<span class="en">Lunar Lander</span>
</a></li>
<li><a href="<?cs var:toroot ?>guide/samples/NotePad/index.html">
- <span class="en">NotePad</span>
+ <span class="en">Note Pad</span>
+ </a></li>
+ <li><a href="<?cs var:toroot ?>guide/samples/Snake/index.html">
+ <span class="en">Snake</span>
+ </a></li>
+ <li><a href="<?cs var:toroot ?>guide/samples/SoftKeyboard/index.html">
+ <span class="en">Soft Keyboard</span>
</a></li>
</ul>
</li>
<?cs /if ?>
</ul>
</li>
+
<li>
<h2><span class="en">Appendix</span>
diff --git a/docs/html/guide/samples/images/HomeSample.png b/docs/html/guide/samples/images/HomeSample.png
new file mode 100644
index 0000000..990bebb
--- /dev/null
+++ b/docs/html/guide/samples/images/HomeSample.png
Binary files differ
diff --git a/docs/html/guide/samples/images/JetBoy.png b/docs/html/guide/samples/images/JetBoy.png
new file mode 100644
index 0000000..3da0448
--- /dev/null
+++ b/docs/html/guide/samples/images/JetBoy.png
Binary files differ
diff --git a/docs/html/guide/samples/images/Snake.png b/docs/html/guide/samples/images/Snake.png
new file mode 100644
index 0000000..c5211d8
--- /dev/null
+++ b/docs/html/guide/samples/images/Snake.png
Binary files differ
diff --git a/docs/html/guide/samples/images/SoftKeyboard.png b/docs/html/guide/samples/images/SoftKeyboard.png
new file mode 100644
index 0000000..8a4ec63
--- /dev/null
+++ b/docs/html/guide/samples/images/SoftKeyboard.png
Binary files differ
diff --git a/docs/html/guide/samples/images/sample_lunarlander.png b/docs/html/guide/samples/images/sample_lunarlander.png
new file mode 100644
index 0000000..a2ff75a
--- /dev/null
+++ b/docs/html/guide/samples/images/sample_lunarlander.png
Binary files differ
diff --git a/docs/html/guide/samples/images/sample_note.png b/docs/html/guide/samples/images/sample_note.png
new file mode 100644
index 0000000..8fc9dcc
--- /dev/null
+++ b/docs/html/guide/samples/images/sample_note.png
Binary files differ
diff --git a/docs/html/guide/samples/images/sample_notepad.png b/docs/html/guide/samples/images/sample_notepad.png
new file mode 100644
index 0000000..46f2211
--- /dev/null
+++ b/docs/html/guide/samples/images/sample_notepad.png
Binary files differ
diff --git a/docs/html/guide/samples/index.jd b/docs/html/guide/samples/index.jd
index 365284d..d8bbc41 100644
--- a/docs/html/guide/samples/index.jd
+++ b/docs/html/guide/samples/index.jd
@@ -15,11 +15,28 @@
<p>You can easily add these applications as projects in your development environment, so that you
can modify them and watch them execute. </p>
<dl>
+
<dt><a href="ApiDemos/index.html">API Demos</a></dt>
- <dd>A variety of small applications that demonstrate simple views and widgets.</dd>
+ <dd>A variety of small applications that demonstrate an extensive collection of framework topics.</dd>
+
+ <dt><a href="Home/index.html">Home</a></dt>
+ <dd>An application for saving notes. Similar (but not identical) to the
+ <a href="{@docRoot}guide/tutorials/notepad/index.html">Notepad tutorial</a>.</dd>
+
+ <dt><a href="JetBoy/index.html">JetBoy</a></dt>
+ <dd>JetBoy is a game that demonstrates the SONiVOX JET interactive music technology, with {@link android.media.JetPlayer}.</dd>
+
<dt><a href="LunarLander/index.html">Lunar Lander</a></dt>
<dd>A classic Lunar Lander game.</dd>
+
<dt><a href="NotePad/index.html">Note Pad</a></dt>
<dd>An application for saving notes. Similar (but not identical) to the
<a href="{@docRoot}guide/tutorials/notepad/index.html">Notepad tutorial</a>.</dd>
+
+ <dt><a href="Snake/index.html">Snake</a></dt>
+ <dd>An implementation of the classic game "Snake."</dd>
+
+ <dt><a href="SoftKeyboard/index.html">Soft Keyboard</a></dt>
+ <dd>An example of writing an input method for a software keyboard.</dd>
+
</dl>
diff --git a/graphics/java/android/graphics/drawable/BitmapDrawable.java b/graphics/java/android/graphics/drawable/BitmapDrawable.java
index eade73a..1755d4f 100644
--- a/graphics/java/android/graphics/drawable/BitmapDrawable.java
+++ b/graphics/java/android/graphics/drawable/BitmapDrawable.java
@@ -76,6 +76,7 @@
* @deprecated Use {@link #BitmapDrawable(Resources)} to ensure
* that the drawable has correctly set its target density.
*/
+ @Deprecated
public BitmapDrawable() {
mBitmapState = new BitmapState((Bitmap) null);
}
@@ -97,6 +98,7 @@
* @deprecated Use {@link #BitmapDrawable(Resources, Bitmap)} to ensure
* that the drawable has correctly set its target density.
*/
+ @Deprecated
public BitmapDrawable(Bitmap bitmap) {
this(new BitmapState(bitmap));
}
diff --git a/graphics/java/android/graphics/drawable/NinePatchDrawable.java b/graphics/java/android/graphics/drawable/NinePatchDrawable.java
index d5c8a08..b175bb6 100644
--- a/graphics/java/android/graphics/drawable/NinePatchDrawable.java
+++ b/graphics/java/android/graphics/drawable/NinePatchDrawable.java
@@ -56,6 +56,7 @@
* @deprecated Use {@link #NinePatchDrawable(Resources, Bitmap, byte[], Rect, String)}
* to ensure that the drawable has correctly set its target density.
*/
+ @Deprecated
public NinePatchDrawable(Bitmap bitmap, byte[] chunk, Rect padding, String srcName) {
this(new NinePatchState(new NinePatch(bitmap, chunk, srcName), padding));
}
@@ -78,6 +79,7 @@
* @deprecated Use {@link #NinePatchDrawable(Resources, NinePatch)}
* to ensure that the drawable has correctly set its target density.
*/
+ @Deprecated
public NinePatchDrawable(NinePatch patch) {
this(new NinePatchState(patch, null));
}
diff --git a/graphics/java/android/graphics/drawable/StateListDrawable.java b/graphics/java/android/graphics/drawable/StateListDrawable.java
index d22a4ba..a8274b1 100644
--- a/graphics/java/android/graphics/drawable/StateListDrawable.java
+++ b/graphics/java/android/graphics/drawable/StateListDrawable.java
@@ -105,6 +105,8 @@
mStateListState.setConstantSize(a.getBoolean(
com.android.internal.R.styleable.StateListDrawable_constantSize, false));
+ setDither(a.getBoolean(com.android.internal.R.styleable.StateListDrawable_dither, false));
+
a.recycle();
int type;
diff --git a/im/java/android/im/BrandingResourceIDs.java b/im/java/android/im/BrandingResourceIDs.java
deleted file mode 100644
index 9960722..0000000
--- a/im/java/android/im/BrandingResourceIDs.java
+++ /dev/null
@@ -1,52 +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 android.im;
-
-/**
- * @hide
- * Defines the IDs of branding resources.
- */
-public interface BrandingResourceIDs {
- /**
- * The logo icon of the provider which is displayed in the landing page.
- */
- public static final int DRAWABLE_LOGO = 100;
- /**
- * The icon of online presence status.
- */
- public static final int DRAWABLE_PRESENCE_ONLINE = 102;
- /**
- * The icon of busy presence status.
- */
- public static final int DRAWABLE_PRESENCE_BUSY = 103;
- /**
- * The icon of away presence status.
- */
- public static final int DRAWABLE_PRESENCE_AWAY = 104;
- /**
- * The icon of invisible presence status.
- */
- public static final int DRAWABLE_PRESENCE_INVISIBLE = 105;
- /**
- * The icon of offline presence status.
- */
- public static final int DRAWABLE_PRESENCE_OFFLINE = 106;
- /**
- * The label of the menu to go to the contact list screen.
- */
- public static final int STRING_MENU_CONTACT_LIST = 107;
-
-}
diff --git a/im/java/android/im/IImPlugin.aidl b/im/java/android/im/IImPlugin.aidl
deleted file mode 100644
index 229cd0e..0000000
--- a/im/java/android/im/IImPlugin.aidl
+++ /dev/null
@@ -1,69 +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 android.im;
-
-/**
- * @hide
- */
-interface IImPlugin {
- /**
- * Notify the plugin the front door activity is created. This gives the plugin a chance to
- * start its own servics, etc.
- */
- void onStart();
-
- /**
- * Notify the plugin the front door activity is stopping.
- */
- void onStop();
-
- /**
- * Sign in to the service for the account passed in.
- *
- * @param account the account id for the accont to be signed into.
- */
- void signIn(long account);
-
- /**
- * Sign out of the service for the account passed in.
- *
- * @param account the account id for the accont to be signed out of.
- */
- void signOut(long account);
-
- /**
- * Returns the package name used to load the resources for the given provider name.
- *
- * @return The package name to load the resourcs for the given provider.
- */
- String getResourcePackageNameForProvider(String providerName);
-
- /**
- * Returns a map of branding resources for the given provider. The keys are defined
- * in {@link android.im.BrandingResourceIDs}. The values are the resource identifiers generated
- * by the aapt tool.
- *
- * @return The map of branding resources for the given provider.
- */
- Map getResourceMapForProvider(String providerName);
-
- /*
- * Returns a list of supported IM providers.
- *
- * @return a List of supported providers.
- */
- List getSupportedProviders();
-}
diff --git a/im/java/android/im/ImPluginConsts.java b/im/java/android/im/ImPluginConsts.java
deleted file mode 100644
index 416493ff..0000000
--- a/im/java/android/im/ImPluginConsts.java
+++ /dev/null
@@ -1,27 +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 android.im;
-
-/**
- * @hide
- */
-public class ImPluginConsts {
- /**
- * The intent action name for the plugin service.
- */
- public static final String PLUGIN_ACTION_NAME = "android.im.plugin";
-}
\ No newline at end of file
diff --git a/libs/rs/java/Fall/src/com/android/fall/rs/FallRS.java b/libs/rs/java/Fall/src/com/android/fall/rs/FallRS.java
index 3b13bed..8a33d66 100644
--- a/libs/rs/java/Fall/src/com/android/fall/rs/FallRS.java
+++ b/libs/rs/java/Fall/src/com/android/fall/rs/FallRS.java
@@ -103,6 +103,9 @@
private int mMeshWidth;
private int mMeshHeight;
+ @SuppressWarnings({"FieldCanBeLocal"})
+ private RenderScript.TriangleMesh mMesh;
+
private Allocation mRippleMap;
private Allocation mRefractionMap;
@@ -211,8 +214,8 @@
}
}
- RenderScript.TriangleMesh mesh = rs.triangleMeshCreate();
- mesh.setName("WaterMesh");
+ mMesh = rs.triangleMeshCreate();
+ mMesh.setName("WaterMesh");
mMeshWidth = wResolution + 1;
mMeshHeight = hResolution + 1;
diff --git a/libs/rs/java/Galaxy/AndroidManifest.xml b/libs/rs/java/Galaxy/AndroidManifest.xml
deleted file mode 100644
index 6da1e0f..0000000
--- a/libs/rs/java/Galaxy/AndroidManifest.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.galaxy.rs">
-
- <application android:label="GalaxyRS">
-
- <activity
- android:screenOrientation="portrait"
- android:name="Galaxy"
- android:theme="@android:style/Theme.NoTitleBar">
-
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
-
- </activity>
-
- </application>
-
-</manifest>
diff --git a/libs/rs/java/Galaxy/res/drawable-hdpi/flares.png b/libs/rs/java/Galaxy/res/drawable-hdpi/flares.png
deleted file mode 100644
index 3a5c970..0000000
--- a/libs/rs/java/Galaxy/res/drawable-hdpi/flares.png
+++ /dev/null
Binary files differ
diff --git a/libs/rs/java/Galaxy/res/drawable-hdpi/light1.png b/libs/rs/java/Galaxy/res/drawable-hdpi/light1.png
deleted file mode 100644
index 4ffb1ee..0000000
--- a/libs/rs/java/Galaxy/res/drawable-hdpi/light1.png
+++ /dev/null
Binary files differ
diff --git a/libs/rs/java/Galaxy/res/drawable-hdpi/space.jpg b/libs/rs/java/Galaxy/res/drawable-hdpi/space.jpg
deleted file mode 100644
index b61f6a3..0000000
--- a/libs/rs/java/Galaxy/res/drawable-hdpi/space.jpg
+++ /dev/null
Binary files differ
diff --git a/libs/rs/java/Galaxy/res/raw/galaxy.c b/libs/rs/java/Galaxy/res/raw/galaxy.c
deleted file mode 100644
index 9ff449f..0000000
--- a/libs/rs/java/Galaxy/res/raw/galaxy.c
+++ /dev/null
@@ -1,126 +0,0 @@
-// Copyright (C) 2009 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.
-
-#pragma version(1)
-#pragma stateVertex(PVBackground)
-#pragma stateFragment(PFBackground)
-#pragma stateFragmentStore(PFSBackground)
-
-#define RSID_PARTICLES 1
-
-#define PARTICLE_STRUCT_FIELDS_COUNT 6
-#define PARTICLE_STRUCT_ANGLE 0
-#define PARTICLE_STRUCT_DISTANCE 1
-#define PARTICLE_STRUCT_SPEED 2
-#define PARTICLE_STRUCT_RADIUS 3
-#define PARTICLE_STRUCT_S 4
-#define PARTICLE_STRUCT_T 5
-
-#define RSID_PARTICLES_BUFFER 2
-#define PARTICLE_BUFFER_COMPONENTS_COUNT 5
-
-#define PARTICLES_TEXTURES_COUNT 2
-
-#define ELLIPSE_RATIO 0.892f
-
-void drawSpace(int width, int height) {
- bindTexture(NAMED_PFBackground, 0, NAMED_TSpace);
- drawQuadTexCoords(
- 0.0f, 0.0f, 0.0f, 0.0f, 1.0f,
- width, 0.0f, 0.0f, 2.0f, 1.0f,
- width, height, 0.0f, 2.0f, 0.0f,
- 0.0f, height, 0.0f, 0.0f, 0.0f);
-}
-
-void drawLights(int width, int height) {
- float x = (width - 512.0f) * 0.5f;
- float y = (height - 512.0f) * 0.5f;
-
- // increase the size of the texture by 5% on each side
- x -= 512.0f * 0.05f;
-
- bindProgramFragment(NAMED_PFBackground);
- bindTexture(NAMED_PFBackground, 0, NAMED_TLight1);
- drawQuad(x + 512.0f * 1.1f, y , 0.0f,
- x , y , 0.0f,
- x , y + 512.0f, 0.0f,
- x + 512.0f * 1.1f, y + 512.0f, 0.0f);
-}
-
-void drawParticle(float *particle, float *particleBuffer, float w, float h) {
- float distance = particle[PARTICLE_STRUCT_DISTANCE];
- float angle = particle[PARTICLE_STRUCT_ANGLE];
- float speed = particle[PARTICLE_STRUCT_SPEED];
- float r = particle[PARTICLE_STRUCT_RADIUS];
-
- float a = angle + speed;
- float x = distance * sinf_fast(a);
- float y = distance * cosf_fast(a) * ELLIPSE_RATIO;
- float s = particle[PARTICLE_STRUCT_S];
- float t = particle[PARTICLE_STRUCT_T];
-
- float sX = t * x + s * y + w;
- float sY = s * x - t * y + h;
-
- // lower left vertex of the particle's triangle
- particleBuffer[1] = sX - r; // X
- particleBuffer[2] = sY + r; // Y
-
- // lower right vertex of the particle's triangle
- particleBuffer[6] = sX + r; // X
- particleBuffer[7] = sY + r; // Y
-
- // upper middle vertex of the particle's triangle
- particleBuffer[11] = sX; // X
- particleBuffer[12] = sY - r; // Y
-
- particle[PARTICLE_STRUCT_ANGLE] = a;
-}
-
-void drawParticles(int width, int height) {
- bindProgramFragment(NAMED_PFLighting);
- bindProgramFragmentStore(NAMED_PFSLights);
- bindTexture(NAMED_PFLighting, 0, NAMED_TFlares);
-
- int radius = State_galaxyRadius;
- int particlesCount = State_particlesCount;
-
- float *particle = loadArrayF(RSID_PARTICLES, 0);
- float *particleBuffer = loadArrayF(RSID_PARTICLES_BUFFER, 0);
-
- float w = width * 0.5f;
- float h = height * 0.5f;
-
- int i = 0;
- for ( ; i < particlesCount; i++) {
- drawParticle(particle, particleBuffer, w, h);
- particle += PARTICLE_STRUCT_FIELDS_COUNT;
- // each particle is a triangle (3 vertices) of 5 properties (ABGR, X, Y, S, T)
- particleBuffer += 3 * PARTICLE_BUFFER_COMPONENTS_COUNT;
- }
-
- uploadToBufferObject(NAMED_ParticlesBuffer);
- drawSimpleMeshRange(NAMED_ParticlesMesh, 0, particlesCount * 3);
-}
-
-int main(int index) {
- int width = State_width;
- int height = State_height;
-
- drawSpace(width, height);
- drawParticles(width, height);
- drawLights(width, height);
-
- return 1;
-}
diff --git a/libs/rs/java/Galaxy/src/com/android/galaxy/rs/Galaxy.java b/libs/rs/java/Galaxy/src/com/android/galaxy/rs/Galaxy.java
deleted file mode 100644
index 27d333c..0000000
--- a/libs/rs/java/Galaxy/src/com/android/galaxy/rs/Galaxy.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2009 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.galaxy.rs;
-
-import android.app.Activity;
-import android.os.Bundle;
-
-public class Galaxy extends Activity {
- private GalaxyView mView;
-
- @Override
- public void onCreate(Bundle icicle) {
- super.onCreate(icicle);
-
- mView = new GalaxyView(this);
- setContentView(mView);
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- mView.onResume();
- }
-
- @Override
- protected void onPause() {
- super.onPause();
- mView.onPause();
-
- Runtime.getRuntime().exit(0);
- }
-}
\ No newline at end of file
diff --git a/libs/rs/java/Galaxy/src/com/android/galaxy/rs/GalaxyRS.java b/libs/rs/java/Galaxy/src/com/android/galaxy/rs/GalaxyRS.java
deleted file mode 100644
index fae92f7..0000000
--- a/libs/rs/java/Galaxy/src/com/android/galaxy/rs/GalaxyRS.java
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
- * Copyright (C) 2009 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.galaxy.rs;
-
-import android.content.res.Resources;
-import android.renderscript.RenderScript;
-import android.renderscript.ScriptC;
-import android.renderscript.ProgramFragment;
-import android.renderscript.ProgramStore;
-import android.renderscript.ProgramVertex;
-import android.renderscript.Allocation;
-import android.renderscript.Sampler;
-import android.renderscript.Element;
-import android.renderscript.SimpleMesh;
-import android.renderscript.Primitive;
-import android.renderscript.Type;
-import static android.renderscript.Sampler.Value.LINEAR;
-import static android.renderscript.Sampler.Value.NEAREST;
-import static android.renderscript.Sampler.Value.WRAP;
-import static android.renderscript.ProgramStore.DepthFunc.*;
-import static android.renderscript.ProgramStore.BlendDstFunc;
-import static android.renderscript.ProgramStore.BlendSrcFunc;
-import static android.renderscript.ProgramFragment.EnvMode.*;
-import static android.renderscript.Element.*;
-import android.graphics.BitmapFactory;
-import android.graphics.Bitmap;
-import static android.util.MathUtils.*;
-
-import java.util.TimeZone;
-
-@SuppressWarnings({"FieldCanBeLocal"})
-class GalaxyRS {
- private static final int GALAXY_RADIUS = 300;
- private static final int PARTICLES_COUNT = 12000;
- private static final float ELLIPSE_TWIST = 0.023333333f;
-
- private static final int RSID_STATE = 0;
-
- private static final int TEXTURES_COUNT = 3;
- private static final int RSID_TEXTURE_SPACE = 0;
- private static final int RSID_TEXTURE_LIGHT1 = 1;
- private static final int RSID_TEXTURE_FLARES = 2;
-
- private static final int RSID_PARTICLES = 1;
- private static final int PARTICLE_STRUCT_FIELDS_COUNT = 6;
- private static final int PARTICLE_STRUCT_ANGLE = 0;
- private static final int PARTICLE_STRUCT_DISTANCE = 1;
- private static final int PARTICLE_STRUCT_SPEED = 2;
- private static final int PARTICLE_STRUCT_RADIUS = 3;
- private static final int PARTICLE_STRUCT_S = 4;
- private static final int PARTICLE_STRUCT_T = 5;
-
- private static final int RSID_PARTICLES_BUFFER = 2;
-
- private Resources mResources;
- private RenderScript mRS;
-
- private final BitmapFactory.Options mOptionsARGB = new BitmapFactory.Options();
-
- private final int mWidth;
- private final int mHeight;
-
- private ScriptC mScript;
- private Sampler mSampler;
- private Sampler mLightSampler;
- private ProgramFragment mPfBackground;
- private ProgramFragment mPfLighting;
- private ProgramStore mPfsBackground;
- private ProgramStore mPfsLights;
- private ProgramVertex mPvBackground;
- private ProgramVertex.MatrixAllocation mPvOrthoAlloc;
-
- private Allocation[] mTextures;
-
- private Type mStateType;
- private Allocation mState;
- private Allocation mParticles;
- private Allocation mParticlesBuffer;
- private SimpleMesh mParticlesMesh;
-
- private final float[] mFloatData5 = new float[5];
-
- public GalaxyRS(int width, int height) {
- mWidth = width;
- mHeight = height;
- mOptionsARGB.inScaled = false;
- mOptionsARGB.inPreferredConfig = Bitmap.Config.ARGB_8888;
- }
-
- public void init(RenderScript rs, Resources res) {
- mRS = rs;
- mResources = res;
- initRS();
- }
-
- private void initRS() {
- createProgramVertex();
- createProgramFragmentStore();
- createProgramFragment();
- createScriptStructures();
- loadTextures();
-
- ScriptC.Builder sb = new ScriptC.Builder(mRS);
- sb.setType(mStateType, "State", RSID_STATE);
- sb.setScript(mResources, R.raw.galaxy);
- sb.setRoot(true);
-
- mScript = sb.create();
- mScript.setClearColor(0.0f, 0.0f, 0.0f, 1.0f);
- mScript.setTimeZone(TimeZone.getDefault().getID());
-
- mScript.bindAllocation(mState, RSID_STATE);
- mScript.bindAllocation(mParticles, RSID_PARTICLES);
- mScript.bindAllocation(mParticlesBuffer, RSID_PARTICLES_BUFFER);
-
- mRS.contextBindRootScript(mScript);
- }
-
- private void createScriptStructures() {
- createState();
- createParticlesMesh();
- createParticles();
- }
-
- private void createParticlesMesh() {
- final Element.Builder elementBuilder = new Element.Builder(mRS);
- elementBuilder.addUNorm8RGBA();
- elementBuilder.addFloatXY();
- elementBuilder.addFloatST();
- final Element vertexElement = elementBuilder.create();
-
- final SimpleMesh.Builder meshBuilder = new SimpleMesh.Builder(mRS);
- final int vertexSlot = meshBuilder.addVertexType(vertexElement, PARTICLES_COUNT * 3);
- meshBuilder.setPrimitive(Primitive.TRIANGLE);
- mParticlesMesh = meshBuilder.create();
- mParticlesMesh.setName("ParticlesMesh");
-
- mParticlesBuffer = mParticlesMesh.createVertexAllocation(vertexSlot);
- mParticlesBuffer.setName("ParticlesBuffer");
- mParticlesMesh.bindVertexAllocation(mParticlesBuffer, 0);
- }
-
- static class GalaxyState {
- public int frameCount;
- public int width;
- public int height;
- public int particlesCount;
- public int galaxyRadius;
- }
-
- private void createState() {
- GalaxyState state = new GalaxyState();
- state.width = mWidth;
- state.height = mHeight;
- state.particlesCount = PARTICLES_COUNT;
- state.galaxyRadius = GALAXY_RADIUS;
-
- mStateType = Type.createFromClass(mRS, GalaxyState.class, 1, "GalaxyState");
- mState = Allocation.createTyped(mRS, mStateType);
- mState.data(state);
- }
-
- private void createParticles() {
- final float[] particles = new float[PARTICLES_COUNT * PARTICLE_STRUCT_FIELDS_COUNT];
-
- int bufferIndex = 0;
-
- for (int i = 0; i < particles.length; i += PARTICLE_STRUCT_FIELDS_COUNT) {
- createParticle(particles, i, bufferIndex);
- bufferIndex += 3;
- }
-
- mParticles = Allocation.createSized(mRS, USER_FLOAT, particles.length);
- mParticles.data(particles);
- }
-
- @SuppressWarnings({"PointlessArithmeticExpression"})
- private void createParticle(float[] particles, int index, int bufferIndex) {
- float d = abs(randomGauss()) * GALAXY_RADIUS / 2.0f + random(-4.0f, 4.0f);
- float z = randomGauss() * 0.5f * 0.8f * ((GALAXY_RADIUS - d) / (float) GALAXY_RADIUS);
- z += 1.0f;
- float p = d * ELLIPSE_TWIST;
-
- particles[index + PARTICLE_STRUCT_ANGLE] = random(0.0f, (float) (Math.PI * 2.0));
- particles[index + PARTICLE_STRUCT_DISTANCE] = d;
- particles[index + PARTICLE_STRUCT_SPEED] = random(0.0015f, 0.0025f) *
- (0.5f + (0.5f * (float) GALAXY_RADIUS / d)) * 0.7f;
- particles[index + PARTICLE_STRUCT_RADIUS] = z * random(1.2f, 2.1f);
- particles[index + PARTICLE_STRUCT_S] = (float) Math.cos(p);
- particles[index + PARTICLE_STRUCT_T] = (float) Math.sin(p);
-
- int red, green, blue;
- if (d < GALAXY_RADIUS / 3.0f) {
- red = (int) (220 + (d / (float) GALAXY_RADIUS) * 35);
- green = 220;
- blue = 220;
- } else {
- red = 180;
- green = 180;
- blue = (int) constrain(140 + (d / (float) GALAXY_RADIUS) * 115, 140, 255);
- }
-
- final int color = red | green << 8 | blue << 16 | 0xff000000;
-
- final float[] floatData = mFloatData5;
- final Allocation buffer = mParticlesBuffer;
-
- floatData[0] = Float.intBitsToFloat(color);
- floatData[3] = 0.0f;
- floatData[4] = 1.0f;
- buffer.subData1D(bufferIndex, 1, floatData);
-
- bufferIndex++;
- floatData[3] = 1.0f;
- floatData[4] = 1.0f;
- buffer.subData1D(bufferIndex, 1, floatData);
-
- bufferIndex++;
- floatData[3] = 0.5f;
- floatData[4] = 0.0f;
- buffer.subData1D(bufferIndex, 1, floatData);
- }
-
- private static float randomGauss() {
- float x1;
- float x2;
- float w;
-
- do {
- x1 = 2.0f * random(0.0f, 1.0f) - 1.0f;
- x2 = 2.0f * random(0.0f, 1.0f) - 1.0f;
- w = x1 * x1 + x2 * x2;
- } while (w >= 1.0f);
-
- w = (float) Math.sqrt(-2.0 * log(w) / w);
- return x1 * w;
- }
-
- private void loadTextures() {
- mTextures = new Allocation[TEXTURES_COUNT];
-
- final Allocation[] textures = mTextures;
- textures[RSID_TEXTURE_SPACE] = loadTexture(R.drawable.space, "TSpace");
- textures[RSID_TEXTURE_LIGHT1] = loadTextureARGB(R.drawable.light1, "TLight1");
- textures[RSID_TEXTURE_FLARES] = loadTextureARGB(R.drawable.flares, "TFlares");
-
- final int count = textures.length;
- for (int i = 0; i < count; i++) {
- final Allocation texture = textures[i];
- texture.uploadToTexture(0);
- }
- }
-
- private Allocation loadTexture(int id, String name) {
- final Allocation allocation = Allocation.createFromBitmapResource(mRS, mResources,
- id, RGB_565, false);
- allocation.setName(name);
- return allocation;
- }
-
- private Allocation loadTextureARGB(int id, String name) {
- Bitmap b = BitmapFactory.decodeResource(mResources, id, mOptionsARGB);
- final Allocation allocation = Allocation.createFromBitmap(mRS, b, RGBA_8888, false);
- allocation.setName(name);
- return allocation;
- }
-
- private void createProgramFragment() {
- Sampler.Builder sampleBuilder = new Sampler.Builder(mRS);
- sampleBuilder.setMin(LINEAR);
- sampleBuilder.setMag(LINEAR);
- sampleBuilder.setWrapS(WRAP);
- sampleBuilder.setWrapT(WRAP);
- mSampler = sampleBuilder.create();
-
- ProgramFragment.Builder builder = new ProgramFragment.Builder(mRS, null, null);
- builder.setTexEnable(true, 0);
- builder.setTexEnvMode(REPLACE, 0);
- mPfBackground = builder.create();
- mPfBackground.setName("PFBackground");
- mPfBackground.bindSampler(mSampler, 0);
-
- sampleBuilder = new Sampler.Builder(mRS);
- sampleBuilder.setMin(NEAREST);
- sampleBuilder.setMag(NEAREST);
- sampleBuilder.setWrapS(WRAP);
- sampleBuilder.setWrapT(WRAP);
- mLightSampler = sampleBuilder.create();
-
- builder = new ProgramFragment.Builder(mRS, null, null);
- builder.setTexEnable(true, 0);
- builder.setTexEnvMode(MODULATE, 0);
- mPfLighting = builder.create();
- mPfLighting.setName("PFLighting");
- mPfLighting.bindSampler(mLightSampler, 0);
- }
-
- private void createProgramFragmentStore() {
- ProgramStore.Builder builder = new ProgramStore.Builder(mRS, null, null);
- builder.setDepthFunc(ALWAYS);
- builder.setBlendFunc(BlendSrcFunc.ONE, BlendDstFunc.ZERO);
- builder.setDitherEnable(false);
- mPfsBackground = builder.create();
- mPfsBackground.setName("PFSBackground");
-
- builder = new ProgramStore.Builder(mRS, null, null);
- builder.setDepthFunc(ALWAYS);
- builder.setBlendFunc(BlendSrcFunc.ONE, BlendDstFunc.ONE);
- builder.setDitherEnable(false);
- mPfsLights = builder.create();
- mPfsLights.setName("PFSLights");
- }
-
- private void createProgramVertex() {
- mPvOrthoAlloc = new ProgramVertex.MatrixAllocation(mRS);
- //mPvOrthoAlloc.setupProjectionNormalized(mWidth, mHeight);
- mPvOrthoAlloc.setupOrthoWindow(mWidth, mHeight);
-
- ProgramVertex.Builder builder = new ProgramVertex.Builder(mRS, null, null);
- mPvBackground = builder.create();
- mPvBackground.bindAllocation(mPvOrthoAlloc);
- mPvBackground.setName("PVBackground");
- }
-}
diff --git a/libs/rs/java/Galaxy/src/com/android/galaxy/rs/GalaxyView.java b/libs/rs/java/Galaxy/src/com/android/galaxy/rs/GalaxyView.java
deleted file mode 100644
index 4f6d3f0..0000000
--- a/libs/rs/java/Galaxy/src/com/android/galaxy/rs/GalaxyView.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2009 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.galaxy.rs;
-
-import android.content.Context;
-import android.view.SurfaceHolder;
-import android.renderscript.RenderScript;
-import android.renderscript.RSSurfaceView;
-
-class GalaxyView extends RSSurfaceView {
- public GalaxyView(Context context) {
- super(context);
- setFocusable(true);
- setFocusableInTouchMode(true);
- }
-
- public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
- super.surfaceChanged(holder, format, w, h);
-
- RenderScript RS = createRenderScript();
- GalaxyRS render = new GalaxyRS(w, h);
- render.init(RS, getResources());
- }
-}
diff --git a/libs/ui/Surface.cpp b/libs/ui/Surface.cpp
index 36a10cf..474308a 100644
--- a/libs/ui/Surface.cpp
+++ b/libs/ui/Surface.cpp
@@ -602,7 +602,18 @@
mBackbufferIndex = backIdx;
layer_cblk_t* const lcblk = &(cblk->layers[index]);
volatile const surface_info_t* const back = lcblk->surface + backIdx;
- if ((back->flags & surface_info_t::eNeedNewBuffer) || mUsageChanged) {
+
+ const sp<SurfaceBuffer>& backBuffer(mBuffers[backIdx]);
+
+ if (backBuffer==0 &&
+ !((back->flags & surface_info_t::eNeedNewBuffer) || mUsageChanged)) {
+ LOGW("dequeueBuffer: backbuffer is null, but eNeedNewBuffer "
+ "is not set, fetching a buffer anyways...");
+ }
+
+ if ((back->flags & surface_info_t::eNeedNewBuffer) ||mUsageChanged ||
+ backBuffer==0)
+ {
mUsageChanged = false;
err = getBufferLocked(backIdx, mUsage);
if (err == NO_ERROR) {
@@ -614,7 +625,6 @@
}
if (err == NO_ERROR) {
- const sp<SurfaceBuffer>& backBuffer(mBuffers[backIdx]);
if (backBuffer != 0) {
mDirtyRegion.set(backBuffer->width, backBuffer->height);
*buffer = backBuffer.get();
diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java
index 16bf8a2..de944ee 100644
--- a/media/java/android/media/AudioManager.java
+++ b/media/java/android/media/AudioManager.java
@@ -816,37 +816,44 @@
/* Routing bits for setRouting/getRouting API */
/**
* Routing audio output to earpiece
- * @deprecated
+ * @deprecated Do not set audio routing directly, use setSpeakerphoneOn(),
+ * setBluetoothScoOn() methods instead.
*/
@Deprecated public static final int ROUTE_EARPIECE = AudioSystem.ROUTE_EARPIECE;
/**
- * Routing audio output to spaker
- * @deprecated
+ * Routing audio output to speaker
+ * @deprecated Do not set audio routing directly, use setSpeakerphoneOn(),
+ * setBluetoothScoOn() methods instead.
*/
@Deprecated public static final int ROUTE_SPEAKER = AudioSystem.ROUTE_SPEAKER;
/**
* @deprecated use {@link #ROUTE_BLUETOOTH_SCO}
- * @deprecated
+ * @deprecated Do not set audio routing directly, use setSpeakerphoneOn(),
+ * setBluetoothScoOn() methods instead.
*/
@Deprecated public static final int ROUTE_BLUETOOTH = AudioSystem.ROUTE_BLUETOOTH_SCO;
/**
* Routing audio output to bluetooth SCO
- * @deprecated
+ * @deprecated Do not set audio routing directly, use setSpeakerphoneOn(),
+ * setBluetoothScoOn() methods instead.
*/
@Deprecated public static final int ROUTE_BLUETOOTH_SCO = AudioSystem.ROUTE_BLUETOOTH_SCO;
/**
* Routing audio output to headset
- * @deprecated
+ * @deprecated Do not set audio routing directly, use setSpeakerphoneOn(),
+ * setBluetoothScoOn() methods instead.
*/
@Deprecated public static final int ROUTE_HEADSET = AudioSystem.ROUTE_HEADSET;
/**
* Routing audio output to bluetooth A2DP
- * @deprecated
+ * @deprecated Do not set audio routing directly, use setSpeakerphoneOn(),
+ * setBluetoothScoOn() methods instead.
*/
@Deprecated public static final int ROUTE_BLUETOOTH_A2DP = AudioSystem.ROUTE_BLUETOOTH_A2DP;
/**
* Used for mask parameter of {@link #setRouting(int,int,int)}.
- * @deprecated
+ * @deprecated Do not set audio routing directly, use setSpeakerphoneOn(),
+ * setBluetoothScoOn() methods instead.
*/
@Deprecated public static final int ROUTE_ALL = AudioSystem.ROUTE_ALL;
diff --git a/media/java/android/media/AudioSystem.java b/media/java/android/media/AudioSystem.java
index d587f65..dbf6d9d 100644
--- a/media/java/android/media/AudioSystem.java
+++ b/media/java/android/media/AudioSystem.java
@@ -93,8 +93,9 @@
*
* return the current audio mode (NORMAL, RINGTONE, or IN_CALL).
* Returns the current current audio state from the HAL.
+ *
*/
- /** @deprecated */
+ /** @deprecated Do not use. */
public static int getMode() {
return MODE_INVALID;
}
diff --git a/media/java/android/media/MediaPlayer.java b/media/java/android/media/MediaPlayer.java
index a8689f2..6a9a9bd 100644
--- a/media/java/android/media/MediaPlayer.java
+++ b/media/java/android/media/MediaPlayer.java
@@ -539,7 +539,7 @@
* @param request Parcel with the data for the extension. The
* caller must use {@link #newRequest()} to get one.
*
- * @param[out] reply Parcel with the data returned by the
+ * @param reply Output parcel with the data returned by the
* native player.
*
* @return The status code see utils/Errors.h
diff --git a/media/java/android/media/MediaRecorder.java b/media/java/android/media/MediaRecorder.java
index 46ede7f..0a1747a 100644
--- a/media/java/android/media/MediaRecorder.java
+++ b/media/java/android/media/MediaRecorder.java
@@ -168,7 +168,7 @@
/** The following formats are audio only .aac or .amr formats **/
/** @deprecated Deprecated in favor of AMR_NB */
- /** @todo change link when AMR_NB is exposed. Deprecated in favor of {@link MediaRecorder.OutputFormat#AMR_NB} */
+ /** TODO: change link when AMR_NB is exposed. Deprecated in favor of {@link MediaRecorder.OutputFormat#AMR_NB} */
public static final int RAW_AMR = 3;
/** @hide AMR NB file format */
public static final int AMR_NB = 3;
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPlayerApiTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPlayerApiTest.java
index ea42f53..dcb8c43 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPlayerApiTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPlayerApiTest.java
@@ -435,6 +435,13 @@
@LargeTest
public void testLocalMp3PrepareAsyncCallback() throws Exception {
boolean onPrepareSuccess =
+ CodecTest.prepareAsyncCallback(MediaNames.MP3CBR, false);
+ assertTrue("LocalMp3prepareAsyncCallback", onPrepareSuccess);
+ }
+
+ @LargeTest
+ public void testLocalH263AMRPrepareAsyncCallback() throws Exception {
+ boolean onPrepareSuccess =
CodecTest.prepareAsyncCallback(MediaNames.VIDEO_H263_AMR, false);
assertTrue("LocalMp3prepareAsyncCallback", onPrepareSuccess);
}
diff --git a/packages/SubscribedFeedsProvider/src/com/android/providers/subscribedfeeds/SubscribedFeedsProvider.java b/packages/SubscribedFeedsProvider/src/com/android/providers/subscribedfeeds/SubscribedFeedsProvider.java
index d87f5e7..120b4a3 100644
--- a/packages/SubscribedFeedsProvider/src/com/android/providers/subscribedfeeds/SubscribedFeedsProvider.java
+++ b/packages/SubscribedFeedsProvider/src/com/android/providers/subscribedfeeds/SubscribedFeedsProvider.java
@@ -16,6 +16,7 @@
package com.android.providers.subscribedfeeds;
+import android.accounts.Account;
import android.content.UriMatcher;
import android.content.*;
import android.database.Cursor;
@@ -123,6 +124,14 @@
}
@Override
+ protected void onAccountsChanged(Account[] accountsArray) {
+ super.onAccountsChanged(accountsArray);
+ for (Account account : accountsArray) {
+ ContentResolver.setSyncAutomatically(account, "subscribedfeeds", true);
+ }
+ }
+
+ @Override
protected void onDatabaseOpened(SQLiteDatabase db) {
db.markTableSyncable("feeds", "_deleted_feeds");
}
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index df37d35..4e24a4b 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -357,6 +357,11 @@
for (int t=0; t <= ConnectivityManager.MAX_RADIO_TYPE; t++) {
if (t != mNetworkPreference &&
mNetTrackers[t].getNetworkInfo().isConnected()) {
+ if (DBG) {
+ Log.d(TAG, "tearing down " +
+ mNetTrackers[t].getNetworkInfo() +
+ " in enforcePreference");
+ }
teardown(mNetTrackers[t]);
}
}
@@ -1232,6 +1237,10 @@
NetworkInfo i = net.getNetworkInfo();
if (i.isConnected() &&
!mNetAttributes[i.getType()].isDefault()) {
+ if (DBG) {
+ Log.d(TAG, "tearing down " + i +
+ " to restore the default network");
+ }
teardown(net);
}
}
diff --git a/services/java/com/android/server/DockObserver.java b/services/java/com/android/server/DockObserver.java
index 68ff416..2bd039f 100644
--- a/services/java/com/android/server/DockObserver.java
+++ b/services/java/com/android/server/DockObserver.java
@@ -16,7 +16,6 @@
package com.android.server;
-import android.app.ActivityManagerNative;
import android.content.Context;
import android.content.Intent;
import android.os.Handler;
@@ -91,16 +90,12 @@
}
private synchronized final void sendIntent() {
+ Log.d(TAG, "Broadcasting dock state " + mDockState);
+
// Pack up the values and broadcast them to everyone
Intent intent = new Intent(Intent.ACTION_DOCK_EVENT);
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(Intent.EXTRA_DOCK_STATE, mDockState);
-
- // TODO: Should we require a permission?
- if (Log.isLoggable(TAG, Log.VERBOSE)) {
- Log.v(TAG, "Broadcasting dock state " + mDockState);
- }
- ActivityManagerNative.broadcastStickyIntent(intent, null);
+ mContext.sendStickyBroadcast(intent);
}
private final Handler mHandler = new Handler() {
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index ee9fa36..a4b0685 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -42,6 +42,7 @@
import android.app.Notification;
import android.app.PendingIntent;
import android.app.ResultInfo;
+import android.app.Service;
import android.backup.IBackupManager;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
@@ -9385,7 +9386,9 @@
sr.app = null;
sr.executeNesting = 0;
mStoppingServices.remove(sr);
- if (sr.bindings.size() > 0) {
+
+ boolean hasClients = sr.bindings.size() > 0;
+ if (hasClients) {
Iterator<IntentBindRecord> bindings
= sr.bindings.values().iterator();
while (bindings.hasNext()) {
@@ -9406,7 +9409,20 @@
} else if (!allowRestart) {
bringDownServiceLocked(sr, true);
} else {
- scheduleServiceRestartLocked(sr);
+ boolean canceled = scheduleServiceRestartLocked(sr, true);
+
+ // Should the service remain running? Note that in the
+ // extreme case of so many attempts to deliver a command
+ // that it failed, that we also will stop it here.
+ if (sr.startRequested && (sr.stopIfKilled || canceled)) {
+ if (sr.pendingStarts.size() == 0) {
+ sr.startRequested = false;
+ if (!hasClients) {
+ // Whoops, no reason to restart!
+ bringDownServiceLocked(sr, true);
+ }
+ }
+ }
}
}
@@ -9845,35 +9861,55 @@
private final void sendServiceArgsLocked(ServiceRecord r,
boolean oomAdjusted) {
- final int N = r.startArgs.size();
+ final int N = r.pendingStarts.size();
if (N == 0) {
return;
}
- final int BASEID = r.lastStartId - N + 1;
int i = 0;
while (i < N) {
try {
- Intent args = r.startArgs.get(i);
+ ServiceRecord.StartItem si = r.pendingStarts.get(i);
if (DEBUG_SERVICE) Log.v(TAG, "Sending arguments to service: "
- + r.name + " " + r.intent + " args=" + args);
+ + r.name + " " + r.intent + " args=" + si.intent);
+ if (si.intent == null && N > 0) {
+ // If somehow we got a dummy start at the front, then
+ // just drop it here.
+ i++;
+ continue;
+ }
bumpServiceExecutingLocked(r);
if (!oomAdjusted) {
oomAdjusted = true;
updateOomAdjLocked(r.app);
}
- r.app.thread.scheduleServiceArgs(r, BASEID+i, args);
+ int flags = 0;
+ if (si.deliveryCount > 0) {
+ flags |= Service.START_FLAG_RETRY;
+ }
+ if (si.doneExecutingCount > 0) {
+ flags |= Service.START_FLAG_REDELIVERY;
+ }
+ r.app.thread.scheduleServiceArgs(r, si.id, flags, si.intent);
+ si.deliveredTime = SystemClock.uptimeMillis();
+ r.deliveredStarts.add(si);
+ si.deliveryCount++;
i++;
+ } catch (RemoteException e) {
+ // Remote process gone... we'll let the normal cleanup take
+ // care of this.
+ break;
} catch (Exception e) {
+ Log.w(TAG, "Unexpected exception", e);
break;
}
}
if (i == N) {
- r.startArgs.clear();
+ r.pendingStarts.clear();
} else {
while (i > 0) {
- r.startArgs.remove(0);
i--;
+ r.pendingStarts.remove(i);
}
}
}
@@ -9942,19 +9978,61 @@
} finally {
if (!created) {
app.services.remove(r);
- scheduleServiceRestartLocked(r);
+ scheduleServiceRestartLocked(r, false);
}
}
requestServiceBindingsLocked(r);
+
+ // If the service is in the started state, and there are no
+ // pending arguments, then fake up one so its onStartCommand() will
+ // be called.
+ if (r.startRequested && r.callStart && r.pendingStarts.size() == 0) {
+ r.lastStartId++;
+ if (r.lastStartId < 1) {
+ r.lastStartId = 1;
+ }
+ r.pendingStarts.add(new ServiceRecord.StartItem(r.lastStartId, null));
+ }
+
sendServiceArgsLocked(r, true);
}
- private final void scheduleServiceRestartLocked(ServiceRecord r) {
+ private final boolean scheduleServiceRestartLocked(ServiceRecord r,
+ boolean allowCancel) {
+ boolean canceled = false;
+
+ long minDuration = SERVICE_RESTART_DURATION;
+ long resetTime = minDuration*2*2*2;
+
+ // Any delivered but not yet finished starts should be put back
+ // on the pending list.
+ final int N = r.deliveredStarts.size();
+ if (N > 0) {
+ for (int i=N-1; i>=0; i--) {
+ ServiceRecord.StartItem si = r.deliveredStarts.get(i);
+ if (si.intent == null) {
+ // We'll generate this again if needed.
+ } else if (!allowCancel || (si.deliveryCount < ServiceRecord.MAX_DELIVERY_COUNT
+ && si.doneExecutingCount < ServiceRecord.MAX_DONE_EXECUTING_COUNT)) {
+ r.pendingStarts.add(0, si);
+ long dur = SystemClock.uptimeMillis() - si.deliveredTime;
+ dur *= 2;
+ if (minDuration < dur) minDuration = dur;
+ if (resetTime < dur) resetTime = dur;
+ } else {
+ Log.w(TAG, "Canceling start item " + si.intent + " in service "
+ + r.name);
+ canceled = true;
+ }
+ }
+ r.deliveredStarts.clear();
+ }
+
r.totalRestartCount++;
if (r.restartDelay == 0) {
r.restartCount++;
- r.restartDelay = SERVICE_RESTART_DURATION;
+ r.restartDelay = minDuration;
} else {
// If it has been a "reasonably long time" since the service
// was started, then reset our restart duration back to
@@ -9962,17 +10040,21 @@
// on a service that just occasionally gets killed (which is
// a normal case, due to process being killed to reclaim memory).
long now = SystemClock.uptimeMillis();
- if (now > (r.restartTime+(SERVICE_RESTART_DURATION*2*2*2))) {
+ if (now > (r.restartTime+resetTime)) {
r.restartCount = 1;
- r.restartDelay = SERVICE_RESTART_DURATION;
+ r.restartDelay = minDuration;
} else {
- r.restartDelay *= 2;
+ r.restartDelay *= 4;
+ if (r.restartDelay < minDuration) {
+ r.restartDelay = minDuration;
+ }
}
}
if (!mRestartingServices.contains(r)) {
mRestartingServices.add(r);
}
r.cancelNotification();
+
mHandler.removeCallbacks(r.restarter);
mHandler.postDelayed(r.restarter, r.restartDelay);
r.nextRestartTime = SystemClock.uptimeMillis() + r.restartDelay;
@@ -9985,6 +10067,8 @@
msg.what = SERVICE_ERROR_MSG;
msg.obj = r;
mHandler.sendMessage(msg);
+
+ return canceled;
}
final void performServiceRestartLocked(ServiceRecord r) {
@@ -10146,6 +10230,10 @@
r.foregroundId = 0;
r.foregroundNoti = null;
+ // Clear start entries.
+ r.deliveredStarts.clear();
+ r.pendingStarts.clear();
+
if (r.app != null) {
synchronized (r.stats.getBatteryStats()) {
r.stats.stopLaunchedLocked();
@@ -10207,11 +10295,12 @@
+ r.shortName);
}
r.startRequested = true;
- r.startArgs.add(service);
+ r.callStart = false;
r.lastStartId++;
if (r.lastStartId < 1) {
r.lastStartId = 1;
}
+ r.pendingStarts.add(new ServiceRecord.StartItem(r.lastStartId, service));
r.lastActivity = SystemClock.uptimeMillis();
synchronized (r.stats.getBatteryStats()) {
r.stats.startRunningLocked();
@@ -10279,6 +10368,7 @@
r.record.stats.stopRunningLocked();
}
r.record.startRequested = false;
+ r.record.callStart = false;
final long origId = Binder.clearCallingIdentity();
bringDownServiceLocked(r.record, false);
Binder.restoreCallingIdentity(origId);
@@ -10327,10 +10417,35 @@
if (DEBUG_SERVICE) Log.v(TAG, "stopServiceToken: " + className
+ " " + token + " startId=" + startId);
ServiceRecord r = findServiceLocked(className, token);
- if (r != null && (startId < 0 || r.lastStartId == startId)) {
+ if (r != null) {
+ if (startId >= 0) {
+ // Asked to only stop if done with all work. Note that
+ // to avoid leaks, we will take this as dropping all
+ // start items up to and including this one.
+ ServiceRecord.StartItem si = r.findDeliveredStart(startId, false);
+ if (si != null) {
+ while (r.deliveredStarts.size() > 0) {
+ if (r.deliveredStarts.remove(0) == si) {
+ break;
+ }
+ }
+ }
+
+ if (r.lastStartId != startId) {
+ return false;
+ }
+
+ if (r.deliveredStarts.size() > 0) {
+ Log.w(TAG, "stopServiceToken startId " + startId
+ + " is last, but have " + r.deliveredStarts.size()
+ + " remaining args");
+ }
+ }
+
synchronized (r.stats.getBatteryStats()) {
r.stats.stopRunningLocked();
r.startRequested = false;
+ r.callStart = false;
}
final long origId = Binder.clearCallingIdentity();
bringDownServiceLocked(r, false);
@@ -10674,7 +10789,7 @@
}
}
- public void serviceDoneExecuting(IBinder token) {
+ public void serviceDoneExecuting(IBinder token, int type, int startId, int res) {
synchronized(this) {
if (!(token instanceof ServiceRecord)) {
throw new IllegalArgumentException("Invalid service token");
@@ -10692,6 +10807,51 @@
return;
}
+ if (type == 1) {
+ // This is a call from a service start... take care of
+ // book-keeping.
+ r.callStart = true;
+ switch (res) {
+ case Service.START_STICKY_COMPATIBILITY:
+ case Service.START_STICKY: {
+ // We are done with the associated start arguments.
+ r.findDeliveredStart(startId, true);
+ // Don't stop if killed.
+ r.stopIfKilled = false;
+ break;
+ }
+ case Service.START_NOT_STICKY: {
+ // We are done with the associated start arguments.
+ r.findDeliveredStart(startId, true);
+ if (r.lastStartId == startId) {
+ // There is no more work, and this service
+ // doesn't want to hang around if killed.
+ r.stopIfKilled = true;
+ }
+ break;
+ }
+ case Service.START_REDELIVER_INTENT: {
+ // We'll keep this item until they explicitly
+ // call stop for it, but keep track of the fact
+ // that it was delivered.
+ ServiceRecord.StartItem si = r.findDeliveredStart(startId, false);
+ if (si != null) {
+ si.deliveryCount = 0;
+ si.doneExecutingCount++;
+ // Don't stop if killed.
+ r.stopIfKilled = true;
+ }
+ break;
+ }
+ default:
+ throw new IllegalArgumentException(
+ "Unknown service start result: " + res);
+ }
+ if (res == Service.START_STICKY_COMPATIBILITY) {
+ r.callStart = false;
+ }
+ }
+
final long origId = Binder.clearCallingIdentity();
serviceDoneExecutingLocked(r, inStopping);
Binder.restoreCallingIdentity(origId);
diff --git a/services/java/com/android/server/am/ServiceRecord.java b/services/java/com/android/server/am/ServiceRecord.java
index 9318a72..afbf9c7 100644
--- a/services/java/com/android/server/am/ServiceRecord.java
+++ b/services/java/com/android/server/am/ServiceRecord.java
@@ -64,7 +64,28 @@
final HashMap<IBinder, ConnectionRecord> connections
= new HashMap<IBinder, ConnectionRecord>();
// IBinder -> ConnectionRecord of all bound clients
- final List<Intent> startArgs = new ArrayList<Intent>();
+
+ // Maximum number of delivery attempts before giving up.
+ static final int MAX_DELIVERY_COUNT = 3;
+
+ // Maximum number of times it can fail during execution before giving up.
+ static final int MAX_DONE_EXECUTING_COUNT = 6;
+
+ static class StartItem {
+ final int id;
+ final Intent intent;
+ long deliveredTime;
+ int deliveryCount;
+ int doneExecutingCount;
+
+ StartItem(int _id, Intent _intent) {
+ id = _id;
+ intent = _intent;
+ }
+ }
+ final ArrayList<StartItem> deliveredStarts = new ArrayList<StartItem>();
+ // start() arguments which been delivered.
+ final ArrayList<StartItem> pendingStarts = new ArrayList<StartItem>();
// start() arguments that haven't yet been delivered.
ProcessRecord app; // where this service is running or null.
@@ -73,6 +94,8 @@
Notification foregroundNoti; // Notification record of foreground state.
long lastActivity; // last time there was some activity on the service.
boolean startRequested; // someone explicitly called start?
+ boolean stopIfKilled; // last onStart() said to stop if service killed?
+ boolean callStart; // last onStart() has asked to alway be called on restart.
int lastStartId; // identifier of most recent start request.
int executeNesting; // number of outstanding operations keeping foreground.
long executingStart; // start time of last execute request.
@@ -85,6 +108,25 @@
String stringName; // caching of toString
+ void dumpStartList(PrintWriter pw, String prefix, List<StartItem> list, long now) {
+ final int N = list.size();
+ for (int i=0; i<N; i++) {
+ StartItem si = list.get(i);
+ pw.print(prefix); pw.print("#"); pw.print(i);
+ pw.print(" id="); pw.print(si.id);
+ if (now != 0) pw.print(" dur="); pw.print(now-si.deliveredTime);
+ if (si.deliveryCount != 0) {
+ pw.print(" dc="); pw.print(si.deliveryCount);
+ }
+ if (si.doneExecutingCount != 0) {
+ pw.print(" dxc="); pw.print(si.doneExecutingCount);
+ }
+ pw.print(" ");
+ if (si.intent != null) pw.println(si.intent.toString());
+ else pw.println("null");
+ }
+ }
+
void dump(PrintWriter pw, String prefix) {
pw.print(prefix); pw.print("intent={");
pw.print(intent.getIntent().toShortString(true, false));
@@ -108,6 +150,8 @@
pw.print(" restartTime="); pw.println(restartTime);
if (startRequested || lastStartId != 0) {
pw.print(prefix); pw.print("startRequested="); pw.print(startRequested);
+ pw.print(" stopIfKilled="); pw.print(stopIfKilled);
+ pw.print(" callStart="); pw.print(callStart);
pw.print(" lastStartId="); pw.println(lastStartId);
}
if (executeNesting != 0 || crashCount != 0 || restartCount != 0
@@ -118,8 +162,17 @@
pw.print(" nextRestartTime="); pw.print(nextRestartTime);
pw.print(" crashCount="); pw.println(crashCount);
}
+ if (deliveredStarts.size() > 0) {
+ pw.print(prefix); pw.println("Delivered Starts:");
+ dumpStartList(pw, prefix, deliveredStarts, SystemClock.uptimeMillis());
+ }
+ if (pendingStarts.size() > 0) {
+ pw.print(prefix); pw.println("Pending Starts:");
+ dumpStartList(pw, prefix, pendingStarts, 0);
+ }
if (bindings.size() > 0) {
Iterator<IntentBindRecord> it = bindings.values().iterator();
+ pw.print(prefix); pw.println("Bindings:");
while (it.hasNext()) {
IntentBindRecord b = it.next();
pw.print(prefix); pw.print("* IntentBindRecord{");
@@ -180,6 +233,19 @@
restartTime = 0;
}
+ public StartItem findDeliveredStart(int id, boolean remove) {
+ final int N = deliveredStarts.size();
+ for (int i=0; i<N; i++) {
+ StartItem si = deliveredStarts.get(i);
+ if (si.id == id) {
+ if (remove) deliveredStarts.remove(i);
+ return si;
+ }
+ }
+
+ return null;
+ }
+
public void postNotification() {
if (foregroundId != 0 && foregroundNoti != null) {
INotificationManager inm = NotificationManager.getService();
diff --git a/services/java/com/android/server/status/StatusBarPolicy.java b/services/java/com/android/server/status/StatusBarPolicy.java
index 33d899a..c6b085d 100644
--- a/services/java/com/android/server/status/StatusBarPolicy.java
+++ b/services/java/com/android/server/status/StatusBarPolicy.java
@@ -262,6 +262,14 @@
com.android.internal.R.drawable.stat_sys_data_out_e,
com.android.internal.R.drawable.stat_sys_data_inandout_e,
};
+ //3.5G
+ private static final int[] sDataNetType_h = new int[] {
+ com.android.internal.R.drawable.stat_sys_data_connected_h,
+ com.android.internal.R.drawable.stat_sys_data_in_h,
+ com.android.internal.R.drawable.stat_sys_data_out_h,
+ com.android.internal.R.drawable.stat_sys_data_inandout_h,
+ };
+
//CDMA
private static final int[] sDataNetType_evdo = new int[] {
com.android.internal.R.drawable.stat_sys_data_connected_evdo,
@@ -968,6 +976,11 @@
case TelephonyManager.NETWORK_TYPE_UMTS:
mDataIconList = sDataNetType_3g;
break;
+ case TelephonyManager.NETWORK_TYPE_HSDPA:
+ case TelephonyManager.NETWORK_TYPE_HSUPA:
+ case TelephonyManager.NETWORK_TYPE_HSPA:
+ mDataIconList = sDataNetType_h;
+ break;
case TelephonyManager.NETWORK_TYPE_CDMA:
// display 1xRTT for IS95A/B
mDataIconList = this.sDataNetType_1xrtt;
diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java
index 13713e5..4368464 100644
--- a/telephony/java/android/telephony/PhoneNumberUtils.java
+++ b/telephony/java/android/telephony/PhoneNumberUtils.java
@@ -29,7 +29,9 @@
import android.util.Log;
import android.util.SparseIntArray;
+import static com.android.internal.telephony.TelephonyProperties.PROPERTY_ICC_OPERATOR_ISO_COUNTRY;
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_IDP_STRING;
+import static com.android.internal.telephony.TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY;
import java.util.Locale;
import java.util.regex.Matcher;
@@ -929,7 +931,7 @@
"JM", // Jamaica
"PR", // Puerto Rico
"MS", // Montserrat
- "NP", // Northern Mariana Islands
+ "MP", // Northern Mariana Islands
"KN", // Saint Kitts and Nevis
"LC", // Saint Lucia
"VC", // Saint Vincent and the Grenadines
@@ -962,17 +964,7 @@
public static int getFormatTypeForLocale(Locale locale) {
String country = locale.getCountry();
- // Check for the NANP countries
- int length = NANP_COUNTRIES.length;
- for (int i = 0; i < length; i++) {
- if (NANP_COUNTRIES[i].equals(country)) {
- return FORMAT_NANP;
- }
- }
- if (locale.equals(Locale.JAPAN)) {
- return FORMAT_JAPAN;
- }
- return FORMAT_UNKNOWN;
+ return getFormatTypeFromCountryCode(country);
}
/**
@@ -1272,6 +1264,11 @@
*
* Otherwise, this function returns the dial string passed in
*
+ * @param dialStr the original dial string
+ * @return the converted dial string if the current/default countries belong to NANP,
+ * and if there is the "+" in the original dial string. Otherwise, the original dial
+ * string returns.
+ *
* This API is for CDMA only
*
* @hide TODO: pending API Council approval
@@ -1280,8 +1277,13 @@
if (!TextUtils.isEmpty(dialStr)) {
if (isReallyDialable(dialStr.charAt(0)) &&
isNonSeparator(dialStr)) {
- return cdmaCheckAndProcessPlusCodeByNumberFormat(dialStr,
- getFormatTypeForLocale(Locale.getDefault()));
+ String currIso = SystemProperties.get(PROPERTY_OPERATOR_ISO_COUNTRY, "");
+ String defaultIso = SystemProperties.get(PROPERTY_ICC_OPERATOR_ISO_COUNTRY, "");
+ if (!TextUtils.isEmpty(currIso) && !TextUtils.isEmpty(defaultIso)) {
+ return cdmaCheckAndProcessPlusCodeByNumberFormat(dialStr,
+ getFormatTypeFromCountryCode(currIso),
+ getFormatTypeFromCountryCode(defaultIso));
+ }
}
}
return dialStr;
@@ -1296,89 +1298,92 @@
* plus sign, then process the plus sign.
* Currently, this function supports the plus sign conversion within NANP only.
* Specifically, it handles the plus sign in the following ways:
- * 1)+NANP or +1NANP,remove +, e.g.
- * +8475797000 is converted to 8475797000,
+ * 1)+1NANP,remove +, e.g.
* +18475797000 is converted to 18475797000,
- * 2)+non-NANP Numbers,replace + with the current NANP IDP, e.g,
+ * 2)+NANP or +non-NANP Numbers,replace + with the current NANP IDP, e.g,
+ * +8475797000 is converted to 0118475797000,
* +11875767800 is converted to 01111875767800
- * 3)+NANP in post dial string(s), e.g.
- * 8475797000;+8475231753 is converted to 8475797000;8475231753
+ * 3)+1NANP in post dial string(s), e.g.
+ * 8475797000;+18475231753 is converted to 8475797000;18475231753
*
- * This function returns the original dial string if locale/numbering plan
- * aren't supported.
+ *
+ * @param dialStr the original dial string
+ * @param currFormat the numbering system of the current country that the phone is camped on
+ * @param defaultFormat the numbering system of the country that the phone is activated on
+ * @return the converted dial string if the current/default countries belong to NANP,
+ * and if there is the "+" in the original dial string. Otherwise, the original dial
+ * string returns.
*
* @hide
*/
- public static String cdmaCheckAndProcessPlusCodeByNumberFormat(String dialStr,int numFormat) {
+ public static String
+ cdmaCheckAndProcessPlusCodeByNumberFormat(String dialStr,int currFormat,int defaultFormt) {
String retStr = dialStr;
// Checks if the plus sign character is in the passed-in dial string
if (dialStr != null &&
dialStr.lastIndexOf(PLUS_SIGN_STRING) != -1) {
+ // Format the string based on the rules for the country the number is from,
+ // and the current country the phone is camped on.
+ if ((currFormat == defaultFormt) && (currFormat == FORMAT_NANP)) {
+ // Handle case where default and current telephone numbering plans are NANP.
+ String postDialStr = null;
+ String tempDialStr = dialStr;
- String postDialStr = null;
- String tempDialStr = dialStr;
-
- // Sets the retStr to null since the conversion will be performed below.
- retStr = null;
- if (DBG) log("checkAndProcessPlusCode,dialStr=" + dialStr);
- // This routine is to process the plus sign in the dial string by loop through
- // the network portion, post dial portion 1, post dial portion 2... etc. if
- // applied
- do {
- String networkDialStr;
-
- // Format the string based on the rules for the country the number is from
- if (numFormat != FORMAT_NANP) {
- // TODO: to support NANP international conversion and
- // other telephone numbering plan
- // Currently the phone is ever used in non-NANP system
- // return the original dial string
- Log.e("checkAndProcessPlusCode:non-NANP not supported", dialStr);
- return dialStr;
- } else {
- // For the case that the default and current telephone
- // numbering plans are NANP
+ // Sets the retStr to null since the conversion will be performed below.
+ retStr = null;
+ if (DBG) log("checkAndProcessPlusCode,dialStr=" + dialStr);
+ // This routine is to process the plus sign in the dial string by loop through
+ // the network portion, post dial portion 1, post dial portion 2... etc. if
+ // applied
+ do {
+ String networkDialStr;
networkDialStr = extractNetworkPortion(tempDialStr);
// Handles the conversion within NANP
networkDialStr = processPlusCodeWithinNanp(networkDialStr);
- }
- // Concatenates the string that is converted from network portion
- if (!TextUtils.isEmpty(networkDialStr)) {
- if (retStr == null) {
- retStr = networkDialStr;
- } else {
- retStr = retStr.concat(networkDialStr);
- }
- } else {
- // This should never happen since we checked the if dialStr is null
- // and if it contains the plus sign in the begining of this function.
- // The plus sign is part of the network portion.
- Log.e("checkAndProcessPlusCode: null newDialStr", networkDialStr);
- return dialStr;
- }
- postDialStr = extractPostDialPortion(tempDialStr);
- if (!TextUtils.isEmpty(postDialStr)) {
- int dialableIndex = findDialableIndexFromPostDialStr(postDialStr);
- // dialableIndex should always be greater than 0
- if (dialableIndex >= 1) {
- retStr = appendPwCharBackToOrigDialStr(dialableIndex,
- retStr,postDialStr);
- // Skips the P/W character, extracts the dialable portion
- tempDialStr = postDialStr.substring(dialableIndex);
- } else {
- // Non-dialable character such as P/W should not be at the end of
- // the dial string after P/W processing in CdmaConnection.java
- // Set the postDialStr to "" to break out of the loop
- if (dialableIndex < 0) {
- postDialStr = "";
+ // Concatenates the string that is converted from network portion
+ if (!TextUtils.isEmpty(networkDialStr)) {
+ if (retStr == null) {
+ retStr = networkDialStr;
+ } else {
+ retStr = retStr.concat(networkDialStr);
}
- Log.e("wrong postDialStr=", postDialStr);
+ } else {
+ // This should never happen since we checked the if dialStr is null
+ // and if it contains the plus sign in the beginning of this function.
+ // The plus sign is part of the network portion.
+ Log.e("checkAndProcessPlusCode: null newDialStr", networkDialStr);
+ return dialStr;
}
- }
- if (DBG) log("checkAndProcessPlusCode,postDialStr=" + postDialStr);
- } while (!TextUtils.isEmpty(postDialStr) && !TextUtils.isEmpty(tempDialStr));
+ postDialStr = extractPostDialPortion(tempDialStr);
+ if (!TextUtils.isEmpty(postDialStr)) {
+ int dialableIndex = findDialableIndexFromPostDialStr(postDialStr);
+
+ // dialableIndex should always be greater than 0
+ if (dialableIndex >= 1) {
+ retStr = appendPwCharBackToOrigDialStr(dialableIndex,
+ retStr,postDialStr);
+ // Skips the P/W character, extracts the dialable portion
+ tempDialStr = postDialStr.substring(dialableIndex);
+ } else {
+ // Non-dialable character such as P/W should not be at the end of
+ // the dial string after P/W processing in CdmaConnection.java
+ // Set the postDialStr to "" to break out of the loop
+ if (dialableIndex < 0) {
+ postDialStr = "";
+ }
+ Log.e("wrong postDialStr=", postDialStr);
+ }
+ }
+ if (DBG) log("checkAndProcessPlusCode,postDialStr=" + postDialStr);
+ } while (!TextUtils.isEmpty(postDialStr) && !TextUtils.isEmpty(tempDialStr));
+ } else {
+ // TODO: Support NANP international conversion and other telephone numbering plans.
+ // Currently the phone is never used in non-NANP system, so return the original
+ // dial string.
+ Log.e("checkAndProcessPlusCode:non-NANP not supported", dialStr);
+ }
}
return retStr;
}
@@ -1401,6 +1406,20 @@
}
}
+ private static int getFormatTypeFromCountryCode (String country) {
+ // Check for the NANP countries
+ int length = NANP_COUNTRIES.length;
+ for (int i = 0; i < length; i++) {
+ if (NANP_COUNTRIES[i].compareToIgnoreCase(country) == 0) {
+ return FORMAT_NANP;
+ }
+ }
+ if ("jp".compareToIgnoreCase(country) == 0) {
+ return FORMAT_JAPAN;
+ }
+ return FORMAT_UNKNOWN;
+ }
+
/**
* This function checks if the passed in string conforms to the NANP format
* i.e. NXX-NXX-XXXX, N is any digit 2-9 and X is any digit 0-9
@@ -1446,8 +1465,8 @@
/**
* This function handles the plus code conversion within NANP CDMA network
* If the number format is
- * 1)+NANP or +1NANP,remove +,
- * 2)+non-NANP Numbers,replace + with the current IDP
+ * 1)+1NANP,remove +,
+ * 2)other than +1NANP, any + numbers,replace + with the current IDP
*/
private static String processPlusCodeWithinNanp(String networkDialStr) {
String retStr = networkDialStr;
@@ -1459,7 +1478,7 @@
networkDialStr.charAt(0) == PLUS_SIGN_CHAR &&
networkDialStr.length() > 1) {
String newStr = networkDialStr.substring(1);
- if (isNanp(newStr) || isOneNanp(newStr)) {
+ if (isOneNanp(newStr)) {
// Remove the leading plus sign
retStr = newStr;
} else {
diff --git a/telephony/java/android/telephony/PhoneStateListener.java b/telephony/java/android/telephony/PhoneStateListener.java
index e113680..73e7baa5 100644
--- a/telephony/java/android/telephony/PhoneStateListener.java
+++ b/telephony/java/android/telephony/PhoneStateListener.java
@@ -154,8 +154,9 @@
* @see ServiceState#STATE_IN_SERVICE
* @see ServiceState#STATE_OUT_OF_SERVICE
* @see ServiceState#STATE_POWER_OFF
- * @deprecated, @see #onSignalStrengthsChanged
+ * @deprecated see #onSignalStrengthsChanged
*/
+ @Deprecated
public void onSignalStrengthChanged(int asu) {
// default implementation empty
}
diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java
index 50c4d41..06b5c26 100644
--- a/telephony/java/android/telephony/ServiceState.java
+++ b/telephony/java/android/telephony/ServiceState.java
@@ -83,6 +83,12 @@
public static final int RADIO_TECHNOLOGY_EVDO_0 = 7;
/** @hide */
public static final int RADIO_TECHNOLOGY_EVDO_A = 8;
+ /** @hide */
+ public static final int RADIO_TECHNOLOGY_HSDPA = 9;
+ /** @hide */
+ public static final int RADIO_TECHNOLOGY_HSUPA = 10;
+ /** @hide */
+ public static final int RADIO_TECHNOLOGY_HSPA = 11;
/**
* Available registration states for GSM, UMTS and CDMA.
@@ -366,6 +372,15 @@
case 8:
radioTechnology = "EvDo rev. A";
break;
+ case 9:
+ radioTechnology = "HSDPA";
+ break;
+ case 10:
+ radioTechnology = "HSUPA";
+ break;
+ case 11:
+ radioTechnology = "HSPA";
+ break;
default:
Log.w(LOG_TAG, "mRadioTechnology variable out of range.");
break;
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index ed9af66..f3304a3 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -382,6 +382,15 @@
/** Current network is 1xRTT*/
/** @hide */
public static final int NETWORK_TYPE_1xRTT = 7;
+ /** Current network is HSDPA */
+ /** @hide */
+ public static final int NETWORK_TYPE_HSDPA = 8;
+ /** Current network is HSUPA */
+ /** @hide */
+ public static final int NETWORK_TYPE_HSUPA = 9;
+ /** Current network is HSPA */
+ /** @hide */
+ public static final int NETWORK_TYPE_HSPA = 10;
/**
* Returns a constant indicating the radio technology (network type)
@@ -392,35 +401,25 @@
* @see #NETWORK_TYPE_GPRS
* @see #NETWORK_TYPE_EDGE
* @see #NETWORK_TYPE_UMTS
+ * @see #NETWORK_TYPE_HSDPA
+ * @see #NETWORK_TYPE_HSUPA
+ * @see #NETWORK_TYPE_HSPA
* @see #NETWORK_TYPE_CDMA
* @see #NETWORK_TYPE_EVDO_0
* @see #NETWORK_TYPE_EVDO_A
* @see #NETWORK_TYPE_1xRTT
*/
public int getNetworkType() {
- String prop = SystemProperties.get(TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE);
- if ("GPRS".equals(prop)) {
- return NETWORK_TYPE_GPRS;
- }
- else if ("EDGE".equals(prop)) {
- return NETWORK_TYPE_EDGE;
- }
- else if ("UMTS".equals(prop)) {
- return NETWORK_TYPE_UMTS;
- }
- else if ("CDMA".equals(prop)) {
- return NETWORK_TYPE_CDMA;
- }
- else if ("CDMA - EvDo rev. 0".equals(prop)) {
- return NETWORK_TYPE_EVDO_0;
+ try{
+ ITelephony telephony = getITelephony();
+ if (telephony != null) {
+ return telephony.getNetworkType();
+ } else {
+ // This can happen when the ITelephony interface is not up yet.
+ return NETWORK_TYPE_UNKNOWN;
}
- else if ("CDMA - EvDo rev. A".equals(prop)) {
- return NETWORK_TYPE_EVDO_A;
- }
- else if ("CDMA - 1xRTT".equals(prop)) {
- return NETWORK_TYPE_1xRTT;
- }
- else {
+ } catch(RemoteException ex){
+ // This shouldn't happen in the normal case
return NETWORK_TYPE_UNKNOWN;
}
}
@@ -440,6 +439,12 @@
return "EDGE";
case NETWORK_TYPE_UMTS:
return "UMTS";
+ case NETWORK_TYPE_HSDPA:
+ return "HSDPA";
+ case NETWORK_TYPE_HSUPA:
+ return "HSUPA";
+ case NETWORK_TYPE_HSPA:
+ return "HSPA";
case NETWORK_TYPE_CDMA:
return "CDMA";
case NETWORK_TYPE_EVDO_0:
diff --git a/telephony/java/android/telephony/gsm/SmsMessage.java b/telephony/java/android/telephony/gsm/SmsMessage.java
index 84dfca0..37ef912 100644
--- a/telephony/java/android/telephony/gsm/SmsMessage.java
+++ b/telephony/java/android/telephony/gsm/SmsMessage.java
@@ -345,6 +345,7 @@
* the number of code units used, and int[2] is the number of code
* units remaining until the next message. int[3] is the encoding
* type that should be used for the message.
+ * @deprecated Use android.telephony.SmsMessage.
*/
@Deprecated
public static int[] calculateLength(String messageBody, boolean use7bitOnly) {
diff --git a/telephony/java/com/android/internal/telephony/CommandsInterface.java b/telephony/java/com/android/internal/telephony/CommandsInterface.java
index 6ebd8d6..ed8bc1e 100644
--- a/telephony/java/com/android/internal/telephony/CommandsInterface.java
+++ b/telephony/java/com/android/internal/telephony/CommandsInterface.java
@@ -607,8 +607,9 @@
* ar.exception carries exception on failure
* ar.userObject contains the orignal value of result.obj
* ar.result contains a List of DataCallState
- * @deprecated
+ * @deprecated Do not use.
*/
+ @Deprecated
void getPDPContextList(Message result);
/**
@@ -779,8 +780,9 @@
* cause code returned as int[0] in Message.obj.response
* returns an integer cause code defined in TS 24.008
* section 6.1.3.1.3 or close approximation
- * @deprecated
+ * @deprecated Do not use.
*/
+ @Deprecated
void getLastPdpFailCause (Message result);
/**
diff --git a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
index e187c37..cfb465e 100644
--- a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
@@ -453,7 +453,8 @@
}
protected synchronized void setEnabled(int id, boolean enable) {
- if (DBG) Log.d(LOG_TAG, "setEnabled(" + id + ", " + enable + ')');
+ if (DBG) Log.d(LOG_TAG, "setEnabled(" + id + ", " + enable + ") with old state = " +
+ dataEnabled[id] + " and enabledCount = " + enabledCount);
if (dataEnabled[id] != enable) {
dataEnabled[id] = enable;
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index d83b135..cac4de9 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -243,5 +243,9 @@
*/
int getVoiceMessageCount();
+ /**
+ * Returns the network type
+ */
+ int getNetworkType();
}
diff --git a/telephony/java/com/android/internal/telephony/PhoneBase.java b/telephony/java/com/android/internal/telephony/PhoneBase.java
index 04a3749..9edb4c2 100644
--- a/telephony/java/com/android/internal/telephony/PhoneBase.java
+++ b/telephony/java/com/android/internal/telephony/PhoneBase.java
@@ -618,7 +618,7 @@
* This should only be called in GSM mode.
* Only here for some backward compatibility
* issues concerning the GSMPhone class.
- * @deprecated
+ * @deprecated Always returns null.
*/
public List<PdpConnection> getCurrentPdpList() {
return null;
diff --git a/telephony/java/com/android/internal/telephony/RIL.java b/telephony/java/com/android/internal/telephony/RIL.java
index 50bf218..cd6340e 100644
--- a/telephony/java/com/android/internal/telephony/RIL.java
+++ b/telephony/java/com/android/internal/telephony/RIL.java
@@ -2511,6 +2511,7 @@
mRestrictedStateRegistrant.notifyRegistrant(
new AsyncResult (null, ret, null));
}
+ break;
case RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED:
if (RILJ_LOGD) unsljLog(response);
diff --git a/telephony/java/com/android/internal/telephony/ServiceStateTracker.java b/telephony/java/com/android/internal/telephony/ServiceStateTracker.java
index 39806e9..c74bb8d 100644
--- a/telephony/java/com/android/internal/telephony/ServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/ServiceStateTracker.java
@@ -34,6 +34,14 @@
* 1 = GPRS only
* 2 = EDGE
* 3 = UMTS
+ * 4 = IS95A
+ * 5 = IS95B
+ * 6 = 1xRTT
+ * 7 = EvDo_0
+ * 8 = EvDo_A
+ * 9 = HSDPA
+ * 10 = HSUPA
+ * 11 = HSPA
*/
protected static final int DATA_ACCESS_UNKNOWN = 0;
protected static final int DATA_ACCESS_GPRS = 1;
@@ -44,6 +52,9 @@
protected static final int DATA_ACCESS_CDMA_1xRTT = 6;
protected static final int DATA_ACCESS_CDMA_EvDo_0 = 7;
protected static final int DATA_ACCESS_CDMA_EvDo_A = 8;
+ protected static final int DATA_ACCESS_HSDPA = 9;
+ protected static final int DATA_ACCESS_HSUPA = 10;
+ protected static final int DATA_ACCESS_HSPA = 11;
//***** Instance Variables
protected CommandsInterface cm;
diff --git a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java
index 237d533..66eb789 100755
--- a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java
@@ -749,6 +749,9 @@
Intent intent = new Intent(TelephonyIntents.ACTION_SHOW_NOTICE_ECM_BLOCK_OTHERS);
ActivityManagerNative.broadcastStickyIntent(intent, null);
return false;
+ } else if ((mCT.state == Phone.State.OFFHOOK) && mCT.isInEmergencyCall()) {
+ // Do not allow data call to be enabled when emergency call is going on
+ return false;
} else {
return mDataConnection.setDataEnabled(true);
}
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaCallTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaCallTracker.java
index 3b2c90c..806c31d 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaCallTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaCallTracker.java
@@ -73,6 +73,7 @@
CdmaConnection pendingMO;
boolean hangupPendingMO;
boolean pendingCallInEcm=false;
+ boolean mIsInEmergencyCall = false;
CDMAPhone phone;
boolean desiredMute = false; // false = mute off
@@ -219,6 +220,9 @@
// Always unmute when initiating a new call
setMute(false);
+ // Check data call
+ disableDataCallInEmergencyCall(dialString);
+
// In Ecm mode, if another emergency call is dialed, Ecm mode will not exit.
if(!isPhoneInEcmMode || (isPhoneInEcmMode && isEmergencyCall)) {
cm.dial(pendingMO.address, clirMode, obtainCompleteMessage());
@@ -245,6 +249,9 @@
private Connection
dialThreeWay (String dialString) {
if (!foregroundCall.isIdle()) {
+ // Check data call
+ disableDataCallInEmergencyCall(dialString);
+
// Attach the new connection to foregroundCall
pendingMO = new CdmaConnection(phone.getContext(),
dialString, this, foregroundCall);
@@ -556,6 +563,8 @@
// Re-start Ecm timer when the connected emergency call ends
if (mIsEcmTimerCanceled) {
handleEcmTimer(phone.RESTART_ECM_TIMER);
+ } else {
+ mIsInEmergencyCall = false;
}
// Dropped connections are removed from the CallTracker
@@ -1010,6 +1019,26 @@
}
}
+ /**
+ * Disable data call when emergency call is connected
+ */
+ private void disableDataCallInEmergencyCall(String dialString) {
+ if (PhoneNumberUtils.isEmergencyNumber(dialString)) {
+ phone.disableDataConnectivity();
+ mIsInEmergencyCall = true;
+ }
+ }
+
+ /**
+ * Check if current call is in emergency call
+ *
+ * @return true if it is in emergency call
+ * false if it is not in emergency call
+ */
+ boolean isInEmergencyCall() {
+ return mIsInEmergencyCall;
+ }
+
protected void log(String msg) {
Log.d(LOG_TAG, "[CdmaCallTracker] " + msg);
}
diff --git a/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java b/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java
index bb04a43..3c1308b 100755
--- a/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java
@@ -1084,8 +1084,9 @@
}
/**
- * @deprecated
+ * @deprecated Do not use.
*/
+ @Deprecated
public void getPdpContextList(Message response) {
getDataCallList(response);
}
@@ -1095,8 +1096,9 @@
}
/**
- * @deprecated
+ * @deprecated Do not use.
*/
+ @Deprecated
public List<PdpConnection> getCurrentPdpList() {
ArrayList<DataConnection> connections = new ArrayList<DataConnection>();
ArrayList<PdpConnection> pdp_list = new ArrayList<PdpConnection>();
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
index 0c040e6..e7406e2 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
@@ -677,6 +677,7 @@
newGPRSState = regCodeToServiceState(regState);
newDataRoaming = regCodeIsRoaming(regState);
newNetworkType = type;
+ newSS.setRadioTechnology(type);
break;
case EVENT_POLL_STATE_OPERATOR:
@@ -810,6 +811,15 @@
case DATA_ACCESS_UMTS:
ret = "UMTS";
break;
+ case DATA_ACCESS_HSDPA:
+ ret = "HSDPA";
+ break;
+ case DATA_ACCESS_HSUPA:
+ ret = "HSUPA";
+ break;
+ case DATA_ACCESS_HSPA:
+ ret = "HSPA";
+ break;
default:
Log.e(LOG_TAG, "Wrong network type: " + Integer.toString(type));
break;
@@ -1288,7 +1298,7 @@
* that could support voice and data simultaniously.
*/
boolean isConcurrentVoiceAndData() {
- return (networkType == DATA_ACCESS_UMTS);
+ return (networkType >= DATA_ACCESS_UMTS);
}
/**
diff --git a/test-runner/android/test/ProviderTestCase.java b/test-runner/android/test/ProviderTestCase.java
index 445b4eb..668e9f7 100644
--- a/test-runner/android/test/ProviderTestCase.java
+++ b/test-runner/android/test/ProviderTestCase.java
@@ -15,6 +15,7 @@
* @deprecated this class extends InstrumentationTestCase but should extend AndroidTestCase. Use
* ProviderTestCase2, which corrects this problem, instead.
*/
+@Deprecated
public abstract class ProviderTestCase<T extends ContentProvider>
extends InstrumentationTestCase {
diff --git a/test-runner/android/test/TouchUtils.java b/test-runner/android/test/TouchUtils.java
index 52d2ee8..962b2f9 100644
--- a/test-runner/android/test/TouchUtils.java
+++ b/test-runner/android/test/TouchUtils.java
@@ -565,6 +565,7 @@
* {@link android.test.ActivityInstrumentationTestCase2}, which provides more options for
* configuring the Activity under test
*/
+ @Deprecated
public static int dragViewBy(InstrumentationTestCase test, View v, int gravity, int deltaX,
int deltaY) {
int[] xy = new int[2];
diff --git a/libs/rs/java/Galaxy/Android.mk b/tests/BrowserTestPlugin/Android.mk
similarity index 60%
rename from libs/rs/java/Galaxy/Android.mk
rename to tests/BrowserTestPlugin/Android.mk
index 0884e18..968d9e6 100644
--- a/libs/rs/java/Galaxy/Android.mk
+++ b/tests/BrowserTestPlugin/Android.mk
@@ -1,4 +1,3 @@
-#
# Copyright (C) 2009 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,12 +13,24 @@
# limitations under the License.
#
-LOCAL_PATH := $(call my-dir)
+TOP_LOCAL_PATH:= $(call my-dir)
+
+# Build application
+
+LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-#LOCAL_STATIC_JAVA_LIBRARIES := android.renderscript
+LOCAL_MODULE_TAGS := tests
-LOCAL_PACKAGE_NAME := GalaxyRS
+LOCAL_SRC_FILES := $(call all-subdir-java-files)
+
+LOCAL_PACKAGE_NAME := BrowserTestPlugin
+
+LOCAL_JNI_SHARED_LIBRARIES := libtestplugin
include $(BUILD_PACKAGE)
+
+# ============================================================
+
+# Also build all of the sub-targets under this one: the shared library.
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/BrowserTestPlugin/AndroidManifest.xml b/tests/BrowserTestPlugin/AndroidManifest.xml
new file mode 100644
index 0000000..f071ab6
--- /dev/null
+++ b/tests/BrowserTestPlugin/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.testplugin"
+ android:versionCode="1"
+ android:versionName="1.0">
+
+ <uses-permission android:name="android.webkit.permission.PLUGIN"/>
+
+ <uses-sdk android:minSdkVersion="3" />
+
+ <application android:icon="@drawable/browser_test_plugin"
+ android:label="Browser Test Plugin">
+ <service android:name="TestPlugin">
+ <intent-filter>
+ <action android:name="android.webkit.PLUGIN" />
+ </intent-filter>
+ </service>
+ </application>
+
+</manifest>
diff --git a/tests/BrowserTestPlugin/MODULE_LICENSE_APACHE2 b/tests/BrowserTestPlugin/MODULE_LICENSE_APACHE2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/BrowserTestPlugin/MODULE_LICENSE_APACHE2
diff --git a/tests/BrowserTestPlugin/NOTICE b/tests/BrowserTestPlugin/NOTICE
new file mode 100644
index 0000000..9df2554
--- /dev/null
+++ b/tests/BrowserTestPlugin/NOTICE
@@ -0,0 +1,190 @@
+
+ Copyright (c) 2005-2009, 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.
+
+ 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.
+
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
diff --git a/tests/BrowserTestPlugin/jni/Android.mk b/tests/BrowserTestPlugin/jni/Android.mk
new file mode 100644
index 0000000..95a21e9
--- /dev/null
+++ b/tests/BrowserTestPlugin/jni/Android.mk
@@ -0,0 +1,49 @@
+##
+##
+## Copyright 2009, The Android Open Source Project
+##
+## Redistribution and use in source and binary forms, with or without
+## modification, are permitted provided that the following conditions
+## are met:
+## * Redistributions of source code must retain the above copyright
+## notice, this list of conditions and the following disclaimer.
+## * Redistributions in binary form must reproduce the above copyright
+## notice, this list of conditions and the following disclaimer in the
+## documentation and/or other materials provided with the distribution.
+##
+## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+##
+
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+ main.cpp \
+ PluginObject.cpp \
+ event/EventPlugin.cpp \
+
+LOCAL_C_INCLUDES += \
+ $(LOCAL_PATH) \
+ $(LOCAL_PATH)/event \
+ external/webkit/WebCore/bridge \
+ external/webkit/WebCore/plugins \
+ external/webkit/WebCore/platform/android/JavaVM \
+ external/webkit/WebKit/android/plugins
+
+LOCAL_CFLAGS += -fvisibility=hidden
+LOCAL_PRELINK_MODULE := false
+
+LOCAL_MODULE := libtestplugin
+LOCAL_MODULE_TAGS := tests
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/BrowserTestPlugin/jni/PluginObject.cpp b/tests/BrowserTestPlugin/jni/PluginObject.cpp
new file mode 100644
index 0000000..68fca60
--- /dev/null
+++ b/tests/BrowserTestPlugin/jni/PluginObject.cpp
@@ -0,0 +1,202 @@
+/*
+ * Copyright 2009, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in
+ consideration of your agreement to the following terms, and your use, installation,
+ modification or redistribution of this Apple software constitutes acceptance of these
+ terms. If you do not agree with these terms, please do not use, install, modify or
+ redistribute this Apple software.
+
+ In consideration of your agreement to abide by the following terms, and subject to these
+ terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in
+ this original Apple software (the "Apple Software"), to use, reproduce, modify and
+ redistribute the Apple Software, with or without modifications, in source and/or binary
+ forms; provided that if you redistribute the Apple Software in its entirety and without
+ modifications, you must retain this notice and the following text and disclaimers in all
+ such redistributions of the Apple Software. Neither the name, trademarks, service marks
+ or logos of Apple Computer, Inc. may be used to endorse or promote products derived from
+ the Apple Software without specific prior written permission from Apple. Except as expressly
+ stated in this notice, no other rights or licenses, express or implied, are granted by Apple
+ herein, including but not limited to any patent rights that may be infringed by your
+ derivative works or by other works in which the Apple Software may be incorporated.
+
+ The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES,
+ EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT,
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS
+ USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
+
+ IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE,
+ REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND
+ WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR
+ OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdlib.h>
+#include "main.h"
+#include "PluginObject.h"
+
+static void pluginInvalidate(NPObject *obj);
+static bool pluginHasProperty(NPObject *obj, NPIdentifier name);
+static bool pluginHasMethod(NPObject *obj, NPIdentifier name);
+static bool pluginGetProperty(NPObject *obj, NPIdentifier name, NPVariant *variant);
+static bool pluginSetProperty(NPObject *obj, NPIdentifier name, const NPVariant *variant);
+static bool pluginInvoke(NPObject *obj, NPIdentifier name, const NPVariant *args, uint32_t argCount, NPVariant *result);
+static bool pluginInvokeDefault(NPObject *obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
+static NPObject *pluginAllocate(NPP npp, NPClass *theClass);
+static void pluginDeallocate(NPObject *obj);
+static bool pluginRemoveProperty(NPObject *npobj, NPIdentifier name);
+static bool pluginEnumerate(NPObject *npobj, NPIdentifier **value, uint32_t *count);
+
+
+
+static NPClass pluginClass = {
+ NP_CLASS_STRUCT_VERSION,
+ pluginAllocate,
+ pluginDeallocate,
+ pluginInvalidate,
+ pluginHasMethod,
+ pluginInvoke,
+ pluginInvokeDefault,
+ pluginHasProperty,
+ pluginGetProperty,
+ pluginSetProperty,
+ pluginRemoveProperty,
+ pluginEnumerate
+};
+
+NPClass *getPluginClass(void)
+{
+ return &pluginClass;
+}
+
+static bool identifiersInitialized = false;
+
+#define ID_TESTFILE_PROPERTY 0
+#define NUM_PROPERTY_IDENTIFIERS 1
+
+static NPIdentifier pluginPropertyIdentifiers[NUM_PROPERTY_IDENTIFIERS];
+static const NPUTF8 *pluginPropertyIdentifierNames[NUM_PROPERTY_IDENTIFIERS] = {
+ "testfile"
+};
+
+#define ID_GETTESTFILE_METHOD 0
+#define NUM_METHOD_IDENTIFIERS 1
+
+static NPIdentifier pluginMethodIdentifiers[NUM_METHOD_IDENTIFIERS];
+static const NPUTF8 *pluginMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = {
+ "getTestFile"
+};
+
+static void initializeIdentifiers(void)
+{
+ browser->getstringidentifiers(pluginPropertyIdentifierNames, NUM_PROPERTY_IDENTIFIERS, pluginPropertyIdentifiers);
+ browser->getstringidentifiers(pluginMethodIdentifierNames, NUM_METHOD_IDENTIFIERS, pluginMethodIdentifiers);
+}
+
+static bool pluginHasProperty(NPObject *obj, NPIdentifier name)
+{
+ int i;
+ for (i = 0; i < NUM_PROPERTY_IDENTIFIERS; i++)
+ if (name == pluginPropertyIdentifiers[i])
+ return true;
+ return false;
+}
+
+static bool pluginHasMethod(NPObject *obj, NPIdentifier name)
+{
+ int i;
+ for (i = 0; i < NUM_METHOD_IDENTIFIERS; i++)
+ if (name == pluginMethodIdentifiers[i])
+ return true;
+ return false;
+}
+
+static bool pluginGetProperty(NPObject *obj, NPIdentifier name, NPVariant *variant)
+{
+ PluginObject *plugin = (PluginObject *)obj;
+ if (name == pluginPropertyIdentifiers[ID_TESTFILE_PROPERTY]) {
+ BOOLEAN_TO_NPVARIANT(true, *variant);
+ return true;
+ }
+ return false;
+}
+
+static bool pluginSetProperty(NPObject *obj, NPIdentifier name, const NPVariant *variant)
+{
+ return false;
+}
+
+static bool pluginInvoke(NPObject *obj, NPIdentifier name, const NPVariant *args, uint32_t argCount, NPVariant *result)
+{
+ PluginObject *plugin = (PluginObject *)obj;
+ if (name == pluginMethodIdentifiers[ID_GETTESTFILE_METHOD]) {
+ return true;
+ }
+ return false;
+}
+
+static bool pluginInvokeDefault(NPObject *obj, const NPVariant *args, uint32_t argCount, NPVariant *result)
+{
+ return false;
+}
+
+static void pluginInvalidate(NPObject *obj)
+{
+ // Release any remaining references to JavaScript objects.
+}
+
+static NPObject *pluginAllocate(NPP npp, NPClass *theClass)
+{
+ PluginObject *newInstance = (PluginObject*) malloc(sizeof(PluginObject));
+ newInstance->header._class = theClass;
+ newInstance->header.referenceCount = 1;
+
+ if (!identifiersInitialized) {
+ identifiersInitialized = true;
+ initializeIdentifiers();
+ }
+
+ newInstance->npp = npp;
+
+ return &newInstance->header;
+}
+
+static void pluginDeallocate(NPObject *obj)
+{
+ free(obj);
+}
+
+static bool pluginRemoveProperty(NPObject *npobj, NPIdentifier name)
+{
+ return false;
+}
+
+static bool pluginEnumerate(NPObject *npobj, NPIdentifier **value, uint32_t *count)
+{
+ return false;
+}
diff --git a/tests/BrowserTestPlugin/jni/PluginObject.h b/tests/BrowserTestPlugin/jni/PluginObject.h
new file mode 100644
index 0000000..a058d4a
--- /dev/null
+++ b/tests/BrowserTestPlugin/jni/PluginObject.h
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2009, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in
+ consideration of your agreement to the following terms, and your use, installation,
+ modification or redistribution of this Apple software constitutes acceptance of these
+ terms. If you do not agree with these terms, please do not use, install, modify or
+ redistribute this Apple software.
+
+ In consideration of your agreement to abide by the following terms, and subject to these
+ terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in
+ this original Apple software (the "Apple Software"), to use, reproduce, modify and
+ redistribute the Apple Software, with or without modifications, in source and/or binary
+ forms; provided that if you redistribute the Apple Software in its entirety and without
+ modifications, you must retain this notice and the following text and disclaimers in all
+ such redistributions of the Apple Software. Neither the name, trademarks, service marks
+ or logos of Apple Computer, Inc. may be used to endorse or promote products derived from
+ the Apple Software without specific prior written permission from Apple. Except as expressly
+ stated in this notice, no other rights or licenses, express or implied, are granted by Apple
+ herein, including but not limited to any patent rights that may be infringed by your
+ derivative works or by other works in which the Apple Software may be incorporated.
+
+ The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES,
+ EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT,
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS
+ USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
+
+ IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE,
+ REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND
+ WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR
+ OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PluginObject__DEFINED
+#define PluginObject__DEFINED
+
+#include "main.h"
+
+class SubPlugin {
+public:
+ SubPlugin(NPP inst) : m_inst(inst) {}
+ virtual ~SubPlugin() {}
+ virtual int16 handleEvent(const ANPEvent* evt) = 0;
+
+ NPP inst() const { return m_inst; }
+
+private:
+ NPP m_inst;
+};
+
+typedef struct PluginObject {
+ NPObject header;
+ NPP npp;
+ NPWindow* window;
+
+ SubPlugin* subPlugin;
+
+} PluginObject;
+
+NPClass *getPluginClass(void);
+
+#endif // PluginObject__DEFINED
diff --git a/tests/BrowserTestPlugin/jni/event/EventPlugin.cpp b/tests/BrowserTestPlugin/jni/event/EventPlugin.cpp
new file mode 100644
index 0000000..1263204
--- /dev/null
+++ b/tests/BrowserTestPlugin/jni/event/EventPlugin.cpp
@@ -0,0 +1,198 @@
+/*
+ * Copyright 2009, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "EventPlugin.h"
+#include "android_npapi.h"
+
+#include <stdio.h>
+#include <sys/time.h>
+#include <time.h>
+#include <math.h>
+#include <string.h>
+
+extern NPNetscapeFuncs* browser;
+extern ANPCanvasInterfaceV0 gCanvasI;
+extern ANPLogInterfaceV0 gLogI;
+extern ANPPaintInterfaceV0 gPaintI;
+extern ANPSurfaceInterfaceV0 gSurfaceI;
+extern ANPTypefaceInterfaceV0 gTypefaceI;
+
+///////////////////////////////////////////////////////////////////////////////
+
+EventPlugin::EventPlugin(NPP inst) : SubPlugin(inst) {
+
+ // initialize the drawing surface
+ m_surfaceReady = false;
+ m_surface = gSurfaceI.newRasterSurface(inst, kRGB_565_ANPBitmapFormat, false);
+ if(!m_surface)
+ gLogI.log(inst, kError_ANPLogType, "----%p Unable to create Raster surface", inst);
+}
+
+EventPlugin::~EventPlugin() {
+ gSurfaceI.deleteSurface(m_surface);
+}
+
+void EventPlugin::drawPlugin(int surfaceWidth, int surfaceHeight) {
+
+ gLogI.log(inst(), kDebug_ANPLogType, " ------ %p drawing the plugin (%d,%d)", inst(), surfaceWidth, surfaceHeight);
+
+ // get the plugin's dimensions according to the DOM
+ PluginObject *obj = (PluginObject*) inst()->pdata;
+ const int W = obj->window->width;
+ const int H = obj->window->height;
+
+ // compute the current zoom level
+ const float zoomFactorW = static_cast<float>(surfaceWidth) / W;
+ const float zoomFactorH = static_cast<float>(surfaceHeight) / H;
+
+ // check to make sure the zoom level is uniform
+ if (zoomFactorW + .01 < zoomFactorH && zoomFactorW - .01 > zoomFactorH)
+ gLogI.log(inst(), kError_ANPLogType, " ------ %p zoom is out of sync (%f,%f)",
+ inst(), zoomFactorW, zoomFactorH);
+
+ // scale the variables based on the zoom level
+ const int fontSize = (int)(zoomFactorW * 16);
+ const int leftMargin = (int)(zoomFactorW * 10);
+
+ // lock the surface
+ ANPBitmap bitmap;
+ if (!m_surfaceReady || !gSurfaceI.lock(m_surface, &bitmap, NULL)) {
+ gLogI.log(inst(), kError_ANPLogType, " ------ %p unable to lock the plugin", inst());
+ return;
+ }
+
+ // create a canvas
+ ANPCanvas* canvas = gCanvasI.newCanvas(&bitmap);
+ gCanvasI.drawColor(canvas, 0xFFFFFFFF);
+
+ // configure the paint
+ ANPPaint* paint = gPaintI.newPaint();
+ gPaintI.setFlags(paint, gPaintI.getFlags(paint) | kAntiAlias_ANPPaintFlag);
+ gPaintI.setColor(paint, 0xFF0000FF);
+ gPaintI.setTextSize(paint, fontSize);
+
+ // configure the font
+ ANPTypeface* tf = gTypefaceI.createFromName("serif", kItalic_ANPTypefaceStyle);
+ gPaintI.setTypeface(paint, tf);
+ gTypefaceI.unref(tf);
+
+ // retrieve the font metrics
+ ANPFontMetrics fm;
+ gPaintI.getFontMetrics(paint, &fm);
+
+ // write text on the canvas
+ const char c[] = "Browser Test Plugin";
+ gCanvasI.drawText(canvas, c, sizeof(c)-1, leftMargin, -fm.fTop, paint);
+
+ // clean up variables and unlock the surface
+ gPaintI.deletePaint(paint);
+ gCanvasI.deleteCanvas(canvas);
+ gSurfaceI.unlock(m_surface);
+}
+
+void EventPlugin::printToDiv(const char* text, int length) {
+ // Get the plugin's DOM object
+ NPObject* windowObject = NULL;
+ browser->getvalue(inst(), NPNVWindowNPObject, &windowObject);
+
+ if (!windowObject)
+ gLogI.log(inst(), kError_ANPLogType, " ------ %p Unable to retrieve DOM Window", inst());
+
+ // create a string (JS code) that is stored in memory allocated by the browser
+ const char* jsBegin = "var outputDiv = document.getElementById('eventOutput'); outputDiv.innerHTML += ' ";
+ const char* jsEnd = "';";
+
+ // allocate memory and configure pointers
+ int totalLength = strlen(jsBegin) + length + strlen(jsEnd);
+ char* beginMem = (char*)browser->memalloc(totalLength);
+ char* middleMem = beginMem + strlen(jsBegin);
+ char* endMem = middleMem + length;
+
+ // copy into the allocated memory
+ memcpy(beginMem, jsBegin, strlen(jsBegin));
+ memcpy(middleMem, text, length);
+ memcpy(endMem, jsEnd, strlen(jsEnd));
+
+ gLogI.log(inst(), kError_ANPLogType, "text: %.*s\n", totalLength, (char*)beginMem);
+
+ // execute the javascript in the plugin's DOM object
+ NPString script = { (char*)beginMem, totalLength };
+ NPVariant scriptVariant;
+ if (!browser->evaluate(inst(), windowObject, &script, &scriptVariant))
+ gLogI.log(inst(), kError_ANPLogType, " ------ %p Unable to eval the JS.", inst());
+
+ // free the memory allocated within the browser
+ browser->memfree(beginMem);
+}
+
+int16 EventPlugin::handleEvent(const ANPEvent* evt) {
+ switch (evt->eventType) {
+ case kDraw_ANPEventType:
+ gLogI.log(inst(), kError_ANPLogType, " ------ %p the plugin did not request draw events", inst());
+ break;
+ case kSurface_ANPEventType:
+ switch (evt->data.surface.action) {
+ case kCreated_ANPSurfaceAction:
+ m_surfaceReady = true;
+ return 1;
+ case kDestroyed_ANPSurfaceAction:
+ m_surfaceReady = false;
+ return 1;
+ case kChanged_ANPSurfaceAction:
+ drawPlugin(evt->data.surface.data.changed.width,
+ evt->data.surface.data.changed.height);
+ return 1;
+ }
+ break;
+ case kLifecycle_ANPEventType:
+ switch (evt->data.lifecycle.action) {
+ case kOnLoad_ANPLifecycleAction: {
+ char msg[] = "lifecycle-onLoad";
+ printToDiv(msg, strlen(msg));
+ break;
+ }
+ case kGainFocus_ANPLifecycleAction: {
+ char msg[] = "lifecycle-gainFocus";
+ printToDiv(msg, strlen(msg));
+ break;
+ }
+ case kLoseFocus_ANPLifecycleAction: {
+ char msg[] = "lifecycle-loseFocus";
+ printToDiv(msg, strlen(msg));
+ break;
+ }
+ }
+ return 1;
+ case kTouch_ANPEventType:
+ gLogI.log(inst(), kError_ANPLogType, " ------ %p the plugin did not request touch events", inst());
+ break;
+ case kKey_ANPEventType:
+ gLogI.log(inst(), kError_ANPLogType, " ------ %p the plugin did not request key events", inst());
+ break;
+ default:
+ break;
+ }
+ return 0; // unknown or unhandled event
+}
diff --git a/tests/BrowserTestPlugin/jni/event/EventPlugin.h b/tests/BrowserTestPlugin/jni/event/EventPlugin.h
new file mode 100644
index 0000000..73dd6ea
--- /dev/null
+++ b/tests/BrowserTestPlugin/jni/event/EventPlugin.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2009, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "PluginObject.h"
+
+#ifndef eventPlugin__DEFINED
+#define eventPlugin__DEFINED
+
+class EventPlugin : public SubPlugin {
+public:
+ EventPlugin(NPP inst);
+ virtual ~EventPlugin();
+ virtual int16 handleEvent(const ANPEvent* evt);
+
+private:
+ void drawPlugin(int surfaceWidth, int surfaceHeight);
+ void printToDiv(const char* text, int length);
+
+ bool m_surfaceReady;
+ ANPSurface* m_surface;
+};
+
+#endif // eventPlugin__DEFINED
diff --git a/tests/BrowserTestPlugin/jni/main.cpp b/tests/BrowserTestPlugin/jni/main.cpp
new file mode 100644
index 0000000..056ec4d
--- /dev/null
+++ b/tests/BrowserTestPlugin/jni/main.cpp
@@ -0,0 +1,280 @@
+/*
+ * Copyright 2009, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include "android_npapi.h"
+#include "main.h"
+#include "PluginObject.h"
+#include "EventPlugin.h"
+
+NPNetscapeFuncs* browser;
+#define EXPORT __attribute__((visibility("default")))
+
+NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
+ char* argn[], char* argv[], NPSavedData* saved);
+NPError NPP_Destroy(NPP instance, NPSavedData** save);
+NPError NPP_SetWindow(NPP instance, NPWindow* window);
+NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream,
+ NPBool seekable, uint16* stype);
+NPError NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason);
+int32 NPP_WriteReady(NPP instance, NPStream* stream);
+int32 NPP_Write(NPP instance, NPStream* stream, int32 offset, int32 len,
+ void* buffer);
+void NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname);
+void NPP_Print(NPP instance, NPPrint* platformPrint);
+int16 NPP_HandleEvent(NPP instance, void* event);
+void NPP_URLNotify(NPP instance, const char* URL, NPReason reason,
+ void* notifyData);
+NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value);
+NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value);
+
+extern "C" {
+EXPORT NPError NP_Initialize(NPNetscapeFuncs* browserFuncs, NPPluginFuncs* pluginFuncs, void *java_env, void *application_context);
+EXPORT NPError NP_GetValue(NPP instance, NPPVariable variable, void *value);
+EXPORT const char* NP_GetMIMEDescription(void);
+EXPORT void NP_Shutdown(void);
+};
+
+ANPAudioTrackInterfaceV0 gSoundI;
+ANPBitmapInterfaceV0 gBitmapI;
+ANPCanvasInterfaceV0 gCanvasI;
+ANPLogInterfaceV0 gLogI;
+ANPPaintInterfaceV0 gPaintI;
+ANPPathInterfaceV0 gPathI;
+ANPSurfaceInterfaceV0 gSurfaceI;
+ANPSystemInterfaceV0 gSystemI;
+ANPTypefaceInterfaceV0 gTypefaceI;
+ANPWindowInterfaceV0 gWindowI;
+
+#define ARRAY_COUNT(array) (sizeof(array) / sizeof(array[0]))
+
+NPError NP_Initialize(NPNetscapeFuncs* browserFuncs, NPPluginFuncs* pluginFuncs, void *java_env, void *application_context)
+{
+ // Make sure we have a function table equal or larger than we are built against.
+ if (browserFuncs->size < sizeof(NPNetscapeFuncs)) {
+ return NPERR_GENERIC_ERROR;
+ }
+
+ // Copy the function table (structure)
+ browser = (NPNetscapeFuncs*) malloc(sizeof(NPNetscapeFuncs));
+ memcpy(browser, browserFuncs, sizeof(NPNetscapeFuncs));
+
+ // Build the plugin function table
+ pluginFuncs->version = 11;
+ pluginFuncs->size = sizeof(pluginFuncs);
+ pluginFuncs->newp = NPP_New;
+ pluginFuncs->destroy = NPP_Destroy;
+ pluginFuncs->setwindow = NPP_SetWindow;
+ pluginFuncs->newstream = NPP_NewStream;
+ pluginFuncs->destroystream = NPP_DestroyStream;
+ pluginFuncs->asfile = NPP_StreamAsFile;
+ pluginFuncs->writeready = NPP_WriteReady;
+ pluginFuncs->write = (NPP_WriteProcPtr)NPP_Write;
+ pluginFuncs->print = NPP_Print;
+ pluginFuncs->event = NPP_HandleEvent;
+ pluginFuncs->urlnotify = NPP_URLNotify;
+ pluginFuncs->getvalue = NPP_GetValue;
+ pluginFuncs->setvalue = NPP_SetValue;
+
+ static const struct {
+ NPNVariable v;
+ uint32_t size;
+ ANPInterface* i;
+ } gPairs[] = {
+ { kAudioTrackInterfaceV0_ANPGetValue, sizeof(gSoundI), &gSoundI },
+ { kBitmapInterfaceV0_ANPGetValue, sizeof(gBitmapI), &gBitmapI },
+ { kCanvasInterfaceV0_ANPGetValue, sizeof(gCanvasI), &gCanvasI },
+ { kLogInterfaceV0_ANPGetValue, sizeof(gLogI), &gLogI },
+ { kPaintInterfaceV0_ANPGetValue, sizeof(gPaintI), &gPaintI },
+ { kPathInterfaceV0_ANPGetValue, sizeof(gPathI), &gPathI },
+ { kSurfaceInterfaceV0_ANPGetValue, sizeof(gSurfaceI), &gSurfaceI },
+ { kSystemInterfaceV0_ANPGetValue, sizeof(gSystemI), &gSystemI },
+ { kTypefaceInterfaceV0_ANPGetValue, sizeof(gTypefaceI), &gTypefaceI },
+ { kWindowInterfaceV0_ANPGetValue, sizeof(gWindowI), &gWindowI },
+ };
+ for (size_t i = 0; i < ARRAY_COUNT(gPairs); i++) {
+ gPairs[i].i->inSize = gPairs[i].size;
+ NPError err = browser->getvalue(NULL, gPairs[i].v, gPairs[i].i);
+ if (err) {
+ return err;
+ }
+ }
+
+ return NPERR_NO_ERROR;
+}
+
+void NP_Shutdown(void)
+{
+
+}
+
+const char *NP_GetMIMEDescription(void)
+{
+ return "application/x-browsertestplugin:btp:Android Browser Test Plugin";
+}
+
+NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
+ char* argn[], char* argv[], NPSavedData* saved)
+{
+
+
+ gLogI.log(instance, kDebug_ANPLogType, "creating plugin");
+
+ PluginObject *obj = NULL;
+
+ // Scripting functions appeared in NPAPI version 14
+ if (browser->version >= 14) {
+ instance->pdata = browser->createobject (instance, getPluginClass());
+ obj = static_cast<PluginObject*>(instance->pdata);
+ bzero(obj, sizeof(*obj));
+ } else {
+ return NPERR_GENERIC_ERROR;
+ }
+
+ // select the drawing model
+ ANPDrawingModel model = kSurface_ANPDrawingModel;
+
+ // notify the plugin API of the drawing model we wish to use. This must be
+ // done prior to creating certain subPlugin objects (e.g. surfaceViews)
+ NPError err = browser->setvalue(instance, kRequestDrawingModel_ANPSetValue,
+ reinterpret_cast<void*>(model));
+ if (err) {
+ gLogI.log(instance, kError_ANPLogType, "request model %d err %d", model, err);
+ return err;
+ }
+
+ // create the sub-plugin
+ obj->subPlugin = new EventPlugin(instance);
+
+ return NPERR_NO_ERROR;
+}
+
+NPError NPP_Destroy(NPP instance, NPSavedData** save)
+{
+ PluginObject *obj = (PluginObject*) instance->pdata;
+ delete obj->subPlugin;
+
+ return NPERR_NO_ERROR;
+}
+
+NPError NPP_SetWindow(NPP instance, NPWindow* window)
+{
+ PluginObject *obj = (PluginObject*) instance->pdata;
+
+ // Do nothing if browser didn't support NPN_CreateObject which would have created the PluginObject.
+ if (obj != NULL) {
+ obj->window = window;
+ }
+
+ return NPERR_NO_ERROR;
+}
+
+NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype)
+{
+ *stype = NP_ASFILEONLY;
+ return NPERR_NO_ERROR;
+}
+
+NPError NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason)
+{
+ return NPERR_NO_ERROR;
+}
+
+int32 NPP_WriteReady(NPP instance, NPStream* stream)
+{
+ return 0;
+}
+
+int32 NPP_Write(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer)
+{
+ return 0;
+}
+
+void NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname)
+{
+}
+
+void NPP_Print(NPP instance, NPPrint* platformPrint)
+{
+}
+
+int16 NPP_HandleEvent(NPP instance, void* event)
+{
+ PluginObject *obj = reinterpret_cast<PluginObject*>(instance->pdata);
+ const ANPEvent* evt = reinterpret_cast<const ANPEvent*>(event);
+
+ if(!obj->subPlugin) {
+ gLogI.log(instance, kError_ANPLogType, "the sub-plugin is null.");
+ return 0; // unknown or unhandled event
+ }
+ else {
+ return obj->subPlugin->handleEvent(evt);
+ }
+}
+
+void NPP_URLNotify(NPP instance, const char* url, NPReason reason, void* notifyData)
+{
+}
+
+EXPORT NPError NP_GetValue(NPP instance, NPPVariable variable, void *value) {
+
+ if (variable == NPPVpluginNameString) {
+ const char **str = (const char **)value;
+ *str = "Browser Test Plugin";
+ return NPERR_NO_ERROR;
+ }
+
+ if (variable == NPPVpluginDescriptionString) {
+ const char **str = (const char **)value;
+ *str = "Description of Browser Test Plugin";
+ return NPERR_NO_ERROR;
+ }
+
+ return NPERR_GENERIC_ERROR;
+}
+
+NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value)
+{
+ if (variable == NPPVpluginScriptableNPObject) {
+ void **v = (void **)value;
+ PluginObject *obj = (PluginObject*) instance->pdata;
+
+ if (obj)
+ browser->retainobject((NPObject*)obj);
+
+ *v = obj;
+ return NPERR_NO_ERROR;
+ }
+
+ return NPERR_GENERIC_ERROR;
+}
+
+NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value)
+{
+ return NPERR_GENERIC_ERROR;
+}
+
diff --git a/tests/BrowserTestPlugin/jni/main.h b/tests/BrowserTestPlugin/jni/main.h
new file mode 100644
index 0000000..e6e8c73
--- /dev/null
+++ b/tests/BrowserTestPlugin/jni/main.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2009, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <npapi.h>
+#include <npfunctions.h>
+#include <npruntime.h>
+#include "android_npapi.h"
+
+extern NPNetscapeFuncs* browser;
diff --git a/tests/BrowserTestPlugin/res/drawable/browser_test_plugin.png b/tests/BrowserTestPlugin/res/drawable/browser_test_plugin.png
new file mode 100755
index 0000000..47c79d1
--- /dev/null
+++ b/tests/BrowserTestPlugin/res/drawable/browser_test_plugin.png
Binary files differ
diff --git a/tests/BrowserTestPlugin/src/com/android/testplugin/TestPlugin.java b/tests/BrowserTestPlugin/src/com/android/testplugin/TestPlugin.java
new file mode 100644
index 0000000..94a18fd
--- /dev/null
+++ b/tests/BrowserTestPlugin/src/com/android/testplugin/TestPlugin.java
@@ -0,0 +1,15 @@
+package com.android.testplugin;
+
+import android.app.Service;
+import android.content.Intent;
+import android.os.IBinder;
+
+public class TestPlugin extends Service {
+
+ @Override
+ public IBinder onBind(Intent intent) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/tests/CoreTests/android/core/RecurrenceSetTest.java b/tests/CoreTests/android/core/RecurrenceSetTest.java
new file mode 100644
index 0000000..cee324c
--- /dev/null
+++ b/tests/CoreTests/android/core/RecurrenceSetTest.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.core;
+
+import android.content.ContentValues;
+import android.pim.ICalendar;
+import android.pim.RecurrenceSet;
+import android.test.suitebuilder.annotation.SmallTest;
+import android.util.Log;
+import android.provider.Calendar;
+import junit.framework.TestCase;
+
+/**
+ * Test some pim.RecurrenceSet functionality.
+ */
+public class RecurrenceSetTest extends TestCase {
+
+ // Test a recurrence
+ @SmallTest
+ public void testRecurrenceSet0() throws Exception {
+ String recurrence = "DTSTART;TZID=America/New_York:20080221T070000\n"
+ + "DTEND;TZID=America/New_York:20080221T190000\n"
+ + "RRULE:FREQ=DAILY;UNTIL=20080222T000000Z\n"
+ + "EXDATE:20080222T120000Z";
+ verifyPopulateContentValues(recurrence, "FREQ=DAILY;UNTIL=20080222T000000Z", null,
+ null, "20080222T120000Z", 1203595200000L, "America/New_York", "P43200S", 0);
+ }
+
+ // Test 1 day all-day event
+ @SmallTest
+ public void testRecurrenceSet1() throws Exception {
+ String recurrence = "DTSTART;VALUE=DATE:20090821\nDTEND;VALUE=DATE:20090822\n"
+ + "RRULE:FREQ=YEARLY;WKST=SU";
+ verifyPopulateContentValues(recurrence, "FREQ=YEARLY;WKST=SU", null,
+ null, null, 1250812800000L, null, "P1D", 1);
+ }
+
+ // Test 2 day all-day event
+ @SmallTest
+ public void testRecurrenceSet2() throws Exception {
+ String recurrence = "DTSTART;VALUE=DATE:20090821\nDTEND;VALUE=DATE:20090823\n"
+ + "RRULE:FREQ=YEARLY;WKST=SU";
+ verifyPopulateContentValues(recurrence, "FREQ=YEARLY;WKST=SU", null,
+ null, null, 1250812800000L, null, "P2D", 1);
+ }
+
+ // run populateContentValues and verify the results
+ private void verifyPopulateContentValues(String recurrence, String rrule, String rdate,
+ String exrule, String exdate, long dtstart, String tzid, String duration, int allDay)
+ throws ICalendar.FormatException {
+ ICalendar.Component recurrenceComponent =
+ new ICalendar.Component("DUMMY", null /* parent */);
+ ICalendar.parseComponent(recurrenceComponent, recurrence);
+ ContentValues values = new ContentValues();
+ RecurrenceSet.populateContentValues(recurrenceComponent, values);
+ Log.d("KS", "values " + values);
+
+ assertEquals(rrule, values.get(android.provider.Calendar.Events.RRULE));
+ assertEquals(rdate, values.get(android.provider.Calendar.Events.RDATE));
+ assertEquals(exrule, values.get(android.provider.Calendar.Events.EXRULE));
+ assertEquals(exdate, values.get(android.provider.Calendar.Events.EXDATE));
+ assertEquals(dtstart, (long) values.getAsLong(Calendar.Events.DTSTART));
+ assertEquals(tzid, values.get(android.provider.Calendar.Events.EVENT_TIMEZONE));
+ assertEquals(duration, values.get(android.provider.Calendar.Events.DURATION));
+ assertEquals(allDay,
+ (int) values.getAsInteger(android.provider.Calendar.Events.ALL_DAY));
+ }
+}
diff --git a/tests/CoreTests/com/android/internal/telephony/PhoneNumberUtilsTest.java b/tests/CoreTests/com/android/internal/telephony/PhoneNumberUtilsTest.java
index 466b555..7426d33 100644
--- a/tests/CoreTests/com/android/internal/telephony/PhoneNumberUtilsTest.java
+++ b/tests/CoreTests/com/android/internal/telephony/PhoneNumberUtilsTest.java
@@ -338,7 +338,7 @@
@SmallTest
public void testCheckAndProcessPlusCode() {
- assertEquals("8475797000",
+ assertEquals("0118475797000",
PhoneNumberUtils.cdmaCheckAndProcessPlusCode("+8475797000"));
assertEquals("18475797000",
PhoneNumberUtils.cdmaCheckAndProcessPlusCode("+18475797000"));
@@ -350,18 +350,18 @@
PhoneNumberUtils.cdmaCheckAndProcessPlusCode("+11875767800"));
assertEquals("8475797000,18475231753",
PhoneNumberUtils.cdmaCheckAndProcessPlusCode("8475797000,+18475231753"));
- assertEquals("8475797000,18475231753",
+ assertEquals("0118475797000,18475231753",
PhoneNumberUtils.cdmaCheckAndProcessPlusCode("+8475797000,+18475231753"));
- assertEquals("8475797000;8475231753",
- PhoneNumberUtils.cdmaCheckAndProcessPlusCode("8475797000;+8475231753"));
+ assertEquals("8475797000;0118469312345",
+ PhoneNumberUtils.cdmaCheckAndProcessPlusCode("8475797000;+8469312345"));
assertEquals("8475797000,0111234567",
PhoneNumberUtils.cdmaCheckAndProcessPlusCode("8475797000,+1234567"));
assertEquals("847597000;01111875767000",
PhoneNumberUtils.cdmaCheckAndProcessPlusCode("847597000;+11875767000"));
- assertEquals("8475797000,,8475231753",
- PhoneNumberUtils.cdmaCheckAndProcessPlusCode("8475797000,,+8475231753"));
- assertEquals("8475797000;,8475231753",
- PhoneNumberUtils.cdmaCheckAndProcessPlusCode("8475797000;,+8475231753"));
+ assertEquals("8475797000,,0118469312345",
+ PhoneNumberUtils.cdmaCheckAndProcessPlusCode("8475797000,,+8469312345"));
+ assertEquals("8475797000;,0118469312345",
+ PhoneNumberUtils.cdmaCheckAndProcessPlusCode("8475797000;,+8469312345"));
assertEquals("8475797000,;18475231753",
PhoneNumberUtils.cdmaCheckAndProcessPlusCode("8475797000,;+18475231753"));
assertEquals("8475797000;,01111875767000",
@@ -391,17 +391,20 @@
@SmallTest
public void testCheckAndProcessPlusCodeByNumberFormat() {
- assertEquals("+8475797000",
- PhoneNumberUtils.cdmaCheckAndProcessPlusCodeByNumberFormat("+8475797000",
- PhoneNumberUtils.FORMAT_JAPAN));
- assertEquals("+0384756700",
- PhoneNumberUtils.cdmaCheckAndProcessPlusCodeByNumberFormat("+0384756700",
- PhoneNumberUtils.FORMAT_JAPAN));
- assertEquals("+1234567",
- PhoneNumberUtils.cdmaCheckAndProcessPlusCodeByNumberFormat("+1234567",
- PhoneNumberUtils.FORMAT_UNKNOWN));
- assertEquals("+23456700000",
- PhoneNumberUtils.cdmaCheckAndProcessPlusCodeByNumberFormat("+23456700000",
- PhoneNumberUtils.FORMAT_UNKNOWN));
+ assertEquals("18475797000",
+ PhoneNumberUtils.cdmaCheckAndProcessPlusCodeByNumberFormat("+18475797000",
+ PhoneNumberUtils.FORMAT_NANP,PhoneNumberUtils.FORMAT_NANP));
+ assertEquals("+18475797000",
+ PhoneNumberUtils.cdmaCheckAndProcessPlusCodeByNumberFormat("+18475797000",
+ PhoneNumberUtils.FORMAT_NANP,PhoneNumberUtils.FORMAT_JAPAN));
+ assertEquals("+18475797000",
+ PhoneNumberUtils.cdmaCheckAndProcessPlusCodeByNumberFormat("+18475797000",
+ PhoneNumberUtils.FORMAT_NANP,PhoneNumberUtils.FORMAT_UNKNOWN));
+ assertEquals("+18475797000",
+ PhoneNumberUtils.cdmaCheckAndProcessPlusCodeByNumberFormat("+18475797000",
+ PhoneNumberUtils.FORMAT_JAPAN,PhoneNumberUtils.FORMAT_JAPAN));
+ assertEquals("+18475797000",
+ PhoneNumberUtils.cdmaCheckAndProcessPlusCodeByNumberFormat("+18475797000",
+ PhoneNumberUtils.FORMAT_UNKNOWN,PhoneNumberUtils.FORMAT_UNKNOWN));
}
}
diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/CallbackProxy.java b/tests/DumpRenderTree/src/com/android/dumprendertree/CallbackProxy.java
index b61b307..f33b01d 100644
--- a/tests/DumpRenderTree/src/com/android/dumprendertree/CallbackProxy.java
+++ b/tests/DumpRenderTree/src/com/android/dumprendertree/CallbackProxy.java
@@ -61,6 +61,7 @@
private static final int LAYOUT_WAIT_UNTIL_DONE = 40;
private static final int LAYOUT_DUMP_DATABASE_CALLBACKS = 41;
private static final int LAYOUT_SET_CAN_OPEN_WINDOWS = 42;
+ private static final int SET_GEOLOCATION_PERMISSION = 43;
CallbackProxy(EventSender eventSender,
LayoutTestController layoutTestController) {
@@ -202,6 +203,11 @@
case LAYOUT_SET_CAN_OPEN_WINDOWS:
mLayoutTestController.setCanOpenWindows();
break;
+
+ case SET_GEOLOCATION_PERMISSION:
+ mLayoutTestController.setGeolocationPermission(
+ msg.arg1 == 1 ? true : false);
+ break;
}
}
@@ -364,4 +370,8 @@
public void setMockGeolocationError(int code, String message) {
MockGeolocation.getInstance().setError(code, message);
}
+
+ public void setGeolocationPermission(boolean allow) {
+ obtainMessage(SET_GEOLOCATION_PERMISSION, allow ? 1 : 0, 0).sendToTarget();
+ }
}
diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestController.java b/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestController.java
index e1d802a..f535ed7 100644
--- a/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestController.java
+++ b/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestController.java
@@ -62,4 +62,7 @@
// For storage tests
public void dumpDatabaseCallbacks();
public void setCanOpenWindows();
+
+ // For Geolocation tests
+ public void setGeolocationPermission(boolean allow);
}
diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java b/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java
index e060388..96b34b3 100644
--- a/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java
+++ b/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java
@@ -28,6 +28,7 @@
import android.os.Message;
import android.util.Log;
import android.view.ViewGroup;
+import android.webkit.GeolocationPermissions;
import android.webkit.HttpAuthHandler;
import android.webkit.JsPromptResult;
import android.webkit.JsResult;
@@ -425,6 +426,14 @@
mCanOpenWindows = true;
}
+ /**
+ * Sets the Geolocation permission state to be used for all future requests.
+ */
+ public void setGeolocationPermission(boolean allow) {
+ mGeolocationPermissionSet = true;
+ mGeolocationPermission = allow;
+ }
+
private final WebViewClient mViewClient = new WebViewClient(){
@Override
public void onPageFinished(WebView view, String url) {
@@ -575,6 +584,18 @@
callback.updateQuota(currentQuota + 1024 * 1024 * 5);
}
+ /**
+ * Instructs the client to show a prompt to ask the user to set the
+ * Geolocation permission state for the specified origin.
+ */
+ @Override
+ public void onGeolocationPermissionsShowPrompt(String origin,
+ GeolocationPermissions.Callback callback) {
+ if (mGeolocationPermissionSet) {
+ callback.invoke(origin, mGeolocationPermission, false);
+ }
+ }
+
@Override
public void addMessageToConsole(String message, int lineNumber,
String sourceID) {
@@ -687,4 +708,7 @@
static final String RESULT_FILE = "ResultFile";
static final String TIMEOUT_IN_MILLIS = "TimeoutInMillis";
static final String UI_AUTO_TEST = "UiAutoTest";
+
+ private boolean mGeolocationPermissionSet;
+ private boolean mGeolocationPermission;
}
diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp
index 9a5127d..e8410cd 100644
--- a/tools/aapt/Resource.cpp
+++ b/tools/aapt/Resource.cpp
@@ -1238,10 +1238,16 @@
NA = idents.size();
+ bool deprecated = false;
+
String16 comment = symbols->getComment(realClassName);
fprintf(fp, "%s/** ", indentStr);
if (comment.size() > 0) {
- fprintf(fp, "%s\n", String8(comment).string());
+ String8 cmt(comment);
+ fprintf(fp, "%s\n", cmt.string());
+ if (strstr(cmt.string(), "@deprecated") != NULL) {
+ deprecated = true;
+ }
} else {
fprintf(fp, "Attributes that can be used with a %s.\n", nclassName.string());
}
@@ -1317,6 +1323,10 @@
}
fprintf(fp, "%s */\n", getIndentSpace(indent));
+ if (deprecated) {
+ fprintf(fp, "%s@Deprecated\n", indentStr);
+ }
+
fprintf(fp,
"%spublic static final int[] %s = {\n"
"%s",
@@ -1365,11 +1375,17 @@
//printf("%s:%s/%s: 0x%08x\n", String8(package16).string(),
// String8(attr16).string(), String8(name16).string(), typeSpecFlags);
const bool pub = (typeSpecFlags&ResTable_typeSpec::SPEC_PUBLIC) != 0;
-
+
+ bool deprecated = false;
+
fprintf(fp, "%s/**\n", indentStr);
if (comment.size() > 0) {
+ String8 cmt(comment);
fprintf(fp, "%s <p>\n%s @attr description\n", indentStr, indentStr);
- fprintf(fp, "%s %s\n", indentStr, String8(comment).string());
+ fprintf(fp, "%s %s\n", indentStr, cmt.string());
+ if (strstr(cmt.string(), "@deprecated") != NULL) {
+ deprecated = true;
+ }
} else {
fprintf(fp,
"%s <p>This symbol is the offset where the {@link %s.R.attr#%s}\n"
@@ -1381,7 +1397,11 @@
indentStr, nclassName.string());
}
if (typeComment.size() > 0) {
- fprintf(fp, "\n\n%s %s\n", indentStr, String8(typeComment).string());
+ String8 cmt(typeComment);
+ fprintf(fp, "\n\n%s %s\n", indentStr, cmt.string());
+ if (strstr(cmt.string(), "@deprecated") != NULL) {
+ deprecated = true;
+ }
}
if (comment.size() > 0) {
if (pub) {
@@ -1399,6 +1419,9 @@
fprintf(fp, "%s @attr name %s:%s\n", indentStr,
"android", String8(name).string());
fprintf(fp, "%s*/\n", indentStr);
+ if (deprecated) {
+ fprintf(fp, "%s@Deprecated\n", indentStr);
+ }
fprintf(fp,
"%spublic static final int %s_%s = %d;\n",
indentStr, nclassName.string(),
@@ -1440,11 +1463,16 @@
}
String16 comment(sym.comment);
bool haveComment = false;
+ bool deprecated = false;
if (comment.size() > 0) {
haveComment = true;
+ String8 cmt(comment);
fprintf(fp,
"%s/** %s\n",
- getIndentSpace(indent), String8(comment).string());
+ getIndentSpace(indent), cmt.string());
+ if (strstr(cmt.string(), "@deprecated") != NULL) {
+ deprecated = true;
+ }
} else if (sym.isPublic && !includePrivate) {
sym.sourcePos.warning("No comment for public symbol %s:%s/%s",
assets->getPackage().string(), className.string(),
@@ -1452,20 +1480,25 @@
}
String16 typeComment(sym.typeComment);
if (typeComment.size() > 0) {
+ String8 cmt(typeComment);
if (!haveComment) {
haveComment = true;
fprintf(fp,
- "%s/** %s\n",
- getIndentSpace(indent), String8(typeComment).string());
+ "%s/** %s\n", getIndentSpace(indent), cmt.string());
} else {
fprintf(fp,
- "%s %s\n",
- getIndentSpace(indent), String8(typeComment).string());
+ "%s %s\n", getIndentSpace(indent), cmt.string());
+ }
+ if (strstr(cmt.string(), "@deprecated") != NULL) {
+ deprecated = true;
}
}
if (haveComment) {
fprintf(fp,"%s */\n", getIndentSpace(indent));
}
+ if (deprecated) {
+ fprintf(fp, "%s@Deprecated\n", getIndentSpace(indent));
+ }
fprintf(fp, "%spublic static final int %s=0x%08x;\n",
getIndentSpace(indent),
String8(name).string(), (int)sym.int32Val);
@@ -1484,17 +1517,25 @@
return UNKNOWN_ERROR;
}
String16 comment(sym.comment);
+ bool deprecated = false;
if (comment.size() > 0) {
+ String8 cmt(comment);
fprintf(fp,
"%s/** %s\n"
"%s */\n",
- getIndentSpace(indent), String8(comment).string(),
+ getIndentSpace(indent), cmt.string(),
getIndentSpace(indent));
+ if (strstr(cmt.string(), "@deprecated") != NULL) {
+ deprecated = true;
+ }
} else if (sym.isPublic && !includePrivate) {
sym.sourcePos.warning("No comment for public symbol %s:%s/%s",
assets->getPackage().string(), className.string(),
String8(sym.name).string());
}
+ if (deprecated) {
+ fprintf(fp, "%s@Deprecated\n", getIndentSpace(indent));
+ }
fprintf(fp, "%spublic static final String %s=\"%s\";\n",
getIndentSpace(indent),
String8(name).string(), sym.stringVal.string());
diff --git a/tools/layoutlib/api/src/com/android/layoutlib/api/ILayoutBridge.java b/tools/layoutlib/api/src/com/android/layoutlib/api/ILayoutBridge.java
index b069aad..c562650 100644
--- a/tools/layoutlib/api/src/com/android/layoutlib/api/ILayoutBridge.java
+++ b/tools/layoutlib/api/src/com/android/layoutlib/api/ILayoutBridge.java
@@ -70,9 +70,8 @@
* @param projectKey An Object identifying the project. This is used for the cache mechanism.
* @param screenWidth the screen width
* @param screenHeight the screen height
- * @param renderFullHeight if true, the rendering will render the full height needed by the
- * layout. If the layout needs less than <var>screenHeight</var> then the rendering will
- * use <var>screenHeight</var> as the height.
+ * @param renderFullSize if true, the rendering will render the full size needed by the
+ * layout. This size is never smaller than <var>screenWidth</var> x <var>screenHeight</var>.
* @param density the density factor for the screen.
* @param xdpi the screen actual dpi in X
* @param ydpi the screen actual dpi in Y
@@ -94,7 +93,7 @@
*/
ILayoutResult computeLayout(IXmlPullParser layoutDescription,
Object projectKey,
- int screenWidth, int screenHeight, boolean renderFullHeight,
+ int screenWidth, int screenHeight, boolean renderFullSize,
int density, float xdpi, float ydpi,
String themeName, boolean isProjectTheme,
Map<String, Map<String, IResourceValue>> projectResources,
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java
index 02804e8..55fe4ac 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java
@@ -323,7 +323,7 @@
Map<String, Map<String, IResourceValue>> frameworkResources,
IProjectCallback customViewLoader, ILayoutLog logger) {
return computeLayout(layoutDescription, projectKey,
- screenWidth, screenHeight, false /* renderFullHeight */,
+ screenWidth, screenHeight, false /* renderFullSize */,
density, xdpi, ydpi, themeName, isProjectTheme,
projectResources, frameworkResources, customViewLoader, logger);
}
@@ -333,7 +333,7 @@
* @see com.android.layoutlib.api.ILayoutBridge#computeLayout(com.android.layoutlib.api.IXmlPullParser, java.lang.Object, int, int, boolean, int, float, float, java.lang.String, boolean, java.util.Map, java.util.Map, com.android.layoutlib.api.IProjectCallback, com.android.layoutlib.api.ILayoutLog)
*/
public ILayoutResult computeLayout(IXmlPullParser layoutDescription, Object projectKey,
- int screenWidth, int screenHeight, boolean renderFullHeight,
+ int screenWidth, int screenHeight, boolean renderFullSize,
int density, float xdpi, float ydpi,
String themeName, boolean isProjectTheme,
Map<String, Map<String, IResourceValue>> projectResources,
@@ -412,17 +412,22 @@
}
// measure the views
- int w_spec = MeasureSpec.makeMeasureSpec(screenWidth, MeasureSpec.EXACTLY);
- int h_spec;
+ int w_spec, h_spec;
- if (renderFullHeight) {
- // measure the full height needed by the layout.
+ if (renderFullSize) {
+ // measure the full size needed by the layout.
+ w_spec = MeasureSpec.makeMeasureSpec(screenWidth,
+ MeasureSpec.UNSPECIFIED); // this lets us know the actual needed size
h_spec = MeasureSpec.makeMeasureSpec(screenHeight - screenOffset,
MeasureSpec.UNSPECIFIED); // this lets us know the actual needed size
view.measure(w_spec, h_spec);
- int neededHeight = root.getChildAt(0).getMeasuredHeight();
+ int neededWidth = root.getChildAt(0).getMeasuredWidth();
+ if (neededWidth > screenWidth) {
+ screenWidth = neededWidth;
+ }
+ int neededHeight = root.getChildAt(0).getMeasuredHeight();
if (neededHeight > screenHeight - screenOffset) {
screenHeight = neededHeight + screenOffset;
}
@@ -430,6 +435,7 @@
// remeasure with only the size we need
// This must always be done before the call to layout
+ w_spec = MeasureSpec.makeMeasureSpec(screenWidth, MeasureSpec.EXACTLY);
h_spec = MeasureSpec.makeMeasureSpec(screenHeight - screenOffset,
MeasureSpec.EXACTLY);
view.measure(w_spec, h_spec);
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index d8a03a9..27755ed9 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -960,7 +960,7 @@
*
* If this MulticastLock is not reference-counted, the first call to
* {@code release} (after the radio was multicast locked using
- * {@linke #acquire}) will unlock the multicast, and subsequent calls
+ * {@link #acquire}) will unlock the multicast, and subsequent calls
* will be ignored.
*
* Note that if any other Wifi Multicast Locks are still outstanding