Merge change 22566 into eclair
* changes:
Simplify CDMA Status Bar icons
diff --git a/api/current.xml b/api/current.xml
index 7fad5052..4dc4ae4 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -14932,7 +14932,7 @@
synchronized="false"
static="false"
final="false"
- deprecated="deprecated"
+ deprecated="not deprecated"
visibility="public"
>
<parameter name="response" type="android.accounts.IAccountAuthenticatorResponse">
@@ -21568,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"
@@ -23767,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>
@@ -23866,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"
@@ -60400,6 +60507,21 @@
visibility="public"
>
</method>
+<method name="setGammaForText"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="blackGamma" type="float">
+</parameter>
+<parameter name="whiteGamma" type="float">
+</parameter>
+</method>
<field name="BOLD"
type="int"
transient="false"
@@ -95009,6 +95131,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"
@@ -115444,7 +115577,7 @@
synchronized="false"
static="false"
final="false"
- deprecated="not deprecated"
+ deprecated="deprecated"
visibility="public"
>
<parameter name="asu" type="int">
@@ -118413,6 +118546,19 @@
synchronized="false"
static="false"
final="false"
+ deprecated="deprecated"
+ visibility="public"
+>
+<parameter name="instrumentation" type="android.app.Instrumentation">
+</parameter>
+</method>
+<method name="setInstrumentation"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
deprecated="not deprecated"
visibility="public"
>
@@ -118656,6 +118802,19 @@
synchronized="false"
static="false"
final="false"
+ deprecated="deprecated"
+ visibility="public"
+>
+<parameter name="instrumentation" type="android.app.Instrumentation">
+</parameter>
+</method>
+<method name="injectInstrumentation"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
deprecated="not deprecated"
visibility="public"
>
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/AccountManagerService.java b/core/java/android/accounts/AccountManagerService.java
index 140c814..5ed8941 100644
--- a/core/java/android/accounts/AccountManagerService.java
+++ b/core/java/android/accounts/AccountManagerService.java
@@ -23,6 +23,8 @@
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.pm.RegisteredServicesCache;
+import android.content.pm.PackageInfo;
+import android.content.pm.ApplicationInfo;
import android.database.Cursor;
import android.database.DatabaseUtils;
import android.database.sqlite.SQLiteDatabase;
@@ -44,6 +46,7 @@
import android.app.PendingIntent;
import android.app.NotificationManager;
import android.app.Notification;
+import android.app.Activity;
import android.Manifest;
import java.io.FileDescriptor;
@@ -118,8 +121,7 @@
private static final String[] ACCOUNT_NAME_TYPE_PROJECTION =
new String[]{ACCOUNTS_ID, ACCOUNTS_NAME, ACCOUNTS_TYPE};
- private static final Intent ACCOUNTS_CHANGED_INTENT =
- new Intent(Constants.LOGIN_ACCOUNTS_CHANGED_ACTION);
+ private static final Intent ACCOUNTS_CHANGED_INTENT;
private static final String COUNT_OF_MATCHING_GRANTS = ""
+ "SELECT COUNT(*) FROM " + TABLE_GRANTS + ", " + TABLE_ACCOUNTS
@@ -143,6 +145,12 @@
private static final boolean isDebuggableMonkeyBuild =
SystemProperties.getBoolean("ro.monkey", false)
&& SystemProperties.getBoolean("ro.debuggable", false);
+
+ static {
+ ACCOUNTS_CHANGED_INTENT = new Intent(Constants.LOGIN_ACCOUNTS_CHANGED_ACTION);
+ ACCOUNTS_CHANGED_INTENT.setFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
+ }
+
/**
* This should only be called by system code. One should only call this after the service
* has started.
@@ -1474,6 +1482,22 @@
}
}
+ private boolean inSystemImage(int callerUid) {
+ String[] packages = mContext.getPackageManager().getPackagesForUid(callerUid);
+ for (String name : packages) {
+ try {
+ PackageInfo packageInfo =
+ mContext.getPackageManager().getPackageInfo(name, 0 /* flags */);
+ if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
+ return true;
+ }
+ } catch (PackageManager.NameNotFoundException e) {
+ return false;
+ }
+ }
+ return false;
+ }
+
private boolean permissionIsGranted(Account account, String authTokenType, int callerUid) {
final boolean fromAuthenticator = hasAuthenticatorUid(account.type, callerUid);
final boolean hasExplicitGrants = hasExplicitlyGrantedPermission(account, authTokenType);
@@ -1483,7 +1507,7 @@
+ ": is authenticator? " + fromAuthenticator
+ ", has explicit permission? " + hasExplicitGrants);
}
- return fromAuthenticator || hasExplicitGrants;
+ return fromAuthenticator || hasExplicitGrants || inSystemImage(callerUid);
}
private boolean hasAuthenticatorUid(String accountType, int callingUid) {
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 4854952..e43834a 100644
--- a/core/java/android/app/SearchManager.java
+++ b/core/java/android/app/SearchManager.java
@@ -1769,6 +1769,7 @@
/**
* @deprecated This method is an obsolete internal implementation detail. Do not use.
*/
+ @Deprecated
public void onCancel(DialogInterface dialog) {
throw new UnsupportedOperationException();
}
@@ -1776,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/bluetooth/BluetoothUuid.java b/core/java/android/bluetooth/BluetoothUuid.java
index 1ec7fb38..c15bc20 100644
--- a/core/java/android/bluetooth/BluetoothUuid.java
+++ b/core/java/android/bluetooth/BluetoothUuid.java
@@ -37,6 +37,7 @@
public static final UUID Handsfree = UUID.fromString("0000111E-0000-1000-8000-00805F9B34FB");
public static final UUID AvrcpController =
UUID.fromString("0000110E-0000-1000-8000-00805F9B34FB");
+ public static final UUID AvrcpTarget = UUID.fromString("0000110C-0000-1000-8000-00805F9B34FB");
public static boolean isAudioSource(UUID uuid) {
return uuid.equals(AudioSource);
@@ -61,4 +62,8 @@
public static boolean isAvrcpController(UUID uuid) {
return uuid.equals(AvrcpController);
}
+
+ public static boolean isAvrcpTarget(UUID uuid) {
+ return uuid.equals(AvrcpTarget);
+ }
}
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/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 b1421d1..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) {
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/preference/VolumePreference.java b/core/java/android/preference/VolumePreference.java
index db25cfa..46cce52 100644
--- a/core/java/android/preference/VolumePreference.java
+++ b/core/java/android/preference/VolumePreference.java
@@ -16,15 +16,17 @@
package android.preference;
+import android.app.Dialog;
import android.content.Context;
import android.content.res.TypedArray;
import android.database.ContentObserver;
+import android.media.AudioManager;
import android.media.Ringtone;
import android.media.RingtoneManager;
-import android.media.AudioManager;
import android.net.Uri;
import android.os.Handler;
-import android.preference.PreferenceManager;
+import android.os.Parcel;
+import android.os.Parcelable;
import android.provider.Settings;
import android.provider.Settings.System;
import android.util.AttributeSet;
@@ -42,7 +44,7 @@
private static final String TAG = "VolumePreference";
private int mStreamType;
-
+
/** May be null if the dialog isn't visible. */
private SeekBarVolumizer mSeekBarVolumizer;
@@ -54,7 +56,7 @@
mStreamType = a.getInt(android.R.styleable.VolumePreference_streamType, 0);
a.recycle();
}
-
+
public void setStreamType(int streamType) {
mStreamType = streamType;
}
@@ -65,7 +67,7 @@
final SeekBar seekBar = (SeekBar) view.findViewById(com.android.internal.R.id.seekbar);
mSeekBarVolumizer = new SeekBarVolumizer(getContext(), seekBar, mStreamType);
-
+
getPreferenceManager().registerOnActivityStopListener(this);
// grab focus and key events so that pressing the volume buttons in the
@@ -100,7 +102,7 @@
if (!positiveResult && mSeekBarVolumizer != null) {
mSeekBarVolumizer.revertVolume();
}
-
+
cleanup();
}
@@ -113,19 +115,96 @@
*/
private void cleanup() {
getPreferenceManager().unregisterOnActivityStopListener(this);
-
+
if (mSeekBarVolumizer != null) {
+ Dialog dialog = getDialog();
+ if (dialog != null && dialog.isShowing()) {
+ // Stopped while dialog was showing, revert changes
+ mSeekBarVolumizer.revertVolume();
+ }
mSeekBarVolumizer.stop();
mSeekBarVolumizer = null;
}
+
}
-
+
protected void onSampleStarting(SeekBarVolumizer volumizer) {
if (mSeekBarVolumizer != null && volumizer != mSeekBarVolumizer) {
mSeekBarVolumizer.stopSample();
}
}
-
+
+ @Override
+ protected Parcelable onSaveInstanceState() {
+ final Parcelable superState = super.onSaveInstanceState();
+ if (isPersistent()) {
+ // No need to save instance state since it's persistent
+ return superState;
+ }
+
+ final SavedState myState = new SavedState(superState);
+ if (mSeekBarVolumizer != null) {
+ mSeekBarVolumizer.onSaveInstanceState(myState.getVolumeStore());
+ }
+ return myState;
+ }
+
+ @Override
+ protected void onRestoreInstanceState(Parcelable state) {
+ if (state == null || !state.getClass().equals(SavedState.class)) {
+ // Didn't save state for us in onSaveInstanceState
+ super.onRestoreInstanceState(state);
+ return;
+ }
+
+ SavedState myState = (SavedState) state;
+ super.onRestoreInstanceState(myState.getSuperState());
+ if (mSeekBarVolumizer != null) {
+ mSeekBarVolumizer.onRestoreInstanceState(myState.getVolumeStore());
+ }
+ }
+
+ public static class VolumeStore {
+ public int volume = -1;
+ public int originalVolume = -1;
+ }
+
+ private static class SavedState extends BaseSavedState {
+ VolumeStore mVolumeStore = new VolumeStore();
+
+ public SavedState(Parcel source) {
+ super(source);
+ mVolumeStore.volume = source.readInt();
+ mVolumeStore.originalVolume = source.readInt();
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ super.writeToParcel(dest, flags);
+ dest.writeInt(mVolumeStore.volume);
+ dest.writeInt(mVolumeStore.originalVolume);
+ }
+
+ VolumeStore getVolumeStore() {
+ return mVolumeStore;
+ }
+
+ public SavedState(Parcelable superState) {
+ super(superState);
+ }
+
+ public static final Parcelable.Creator<SavedState> CREATOR =
+ new Parcelable.Creator<SavedState>() {
+ public SavedState createFromParcel(Parcel in) {
+ return new SavedState(in);
+ }
+
+ public SavedState[] newArray(int size) {
+ return new SavedState[size];
+ }
+ };
+ }
+
/**
* Turns a {@link SeekBar} into a volume control.
*/
@@ -139,7 +218,7 @@
private int mOriginalStreamVolume;
private Ringtone mRingtone;
- private int mLastProgress;
+ private int mLastProgress = -1;
private SeekBar mSeekBar;
private ContentObserver mVolumeObserver = new ContentObserver(mHandler) {
@@ -153,7 +232,7 @@
}
}
};
-
+
public SeekBarVolumizer(Context context, SeekBar seekBar, int streamType) {
mContext = context;
mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
@@ -207,7 +286,7 @@
postSetVolume(progress);
}
- private void postSetVolume(int progress) {
+ void postSetVolume(int progress) {
// Do the volume changing separately to give responsive UI
mLastProgress = progress;
mHandler.removeCallbacks(this);
@@ -249,5 +328,20 @@
}
postSetVolume(mSeekBar.getProgress());
}
+
+ public void onSaveInstanceState(VolumeStore volumeStore) {
+ if (mLastProgress >= 0) {
+ volumeStore.volume = mLastProgress;
+ volumeStore.originalVolume = mOriginalStreamVolume;
+ }
+ }
+
+ public void onRestoreInstanceState(VolumeStore volumeStore) {
+ if (volumeStore.volume != -1) {
+ mOriginalStreamVolume = volumeStore.originalVolume;
+ mLastProgress = volumeStore.volume;
+ postSetVolume(mLastProgress);
+ }
+ }
}
}
diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java
index 3a4449e..255534d 100644
--- a/core/java/android/provider/ContactsContract.java
+++ b/core/java/android/provider/ContactsContract.java
@@ -343,7 +343,7 @@
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);
@@ -352,7 +352,9 @@
}
return new ByteArrayInputStream(data);
} finally {
- cursor.close();
+ if (cursor != null) {
+ cursor.close();
+ }
}
}
}
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/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/MediaStore.java b/core/java/android/provider/MediaStore.java
index 21e5865..49b5bb1 100644
--- a/core/java/android/provider/MediaStore.java
+++ b/core/java/android/provider/MediaStore.java
@@ -164,6 +164,12 @@
public final static String EXTRA_SIZE_LIMIT = "android.intent.extra.sizeLimit";
/**
+ * Specify the maximum allowed recording duration in seconds.
+ * @hide
+ */
+ public final static String EXTRA_DURATION_LIMIT = "android.intent.extra.durationLimit";
+
+ /**
* The name of the Intent-extra used to indicate a content resolver Uri to be used to
* store the requested image or video.
*/
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index decf6fc..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;
diff --git a/core/java/android/server/BluetoothEventLoop.java b/core/java/android/server/BluetoothEventLoop.java
index 6610d0e..34d6d03 100644
--- a/core/java/android/server/BluetoothEventLoop.java
+++ b/core/java/android/server/BluetoothEventLoop.java
@@ -431,7 +431,7 @@
boolean authorized = false;
UUID uuid = UUID.fromString(deviceUuid);
if (mBluetoothService.isEnabled() &&
- (BluetoothUuid.isAudioSink(uuid) || BluetoothUuid.isAvrcpController(uuid)
+ (BluetoothUuid.isAudioSink(uuid) || BluetoothUuid.isAvrcpTarget(uuid)
|| BluetoothUuid.isAdvAudioDist(uuid))) {
BluetoothA2dp a2dp = new BluetoothA2dp(mContext);
BluetoothDevice device = mAdapter.getRemoteDevice(address);
diff --git a/core/java/android/test/InstrumentationTestCase.java b/core/java/android/test/InstrumentationTestCase.java
index 2145d7c..22d95d1 100644
--- a/core/java/android/test/InstrumentationTestCase.java
+++ b/core/java/android/test/InstrumentationTestCase.java
@@ -43,11 +43,25 @@
*
* @param instrumentation the instrumentation to use with this instance
*/
- public void injectInsrumentation(Instrumentation instrumentation) {
+ public void injectInstrumentation(Instrumentation instrumentation) {
mInstrumentation = instrumentation;
}
/**
+ * Injects instrumentation into this test case. This method is
+ * called by the test runner during test setup.
+ *
+ * @param instrumentation the instrumentation to use with this instance
+ *
+ * @deprecated Incorrect spelling,
+ * use {@link #injectInstrumentation(android.app.Instrumentation) instead.
+ */
+ @Deprecated
+ public void injectInsrumentation(Instrumentation instrumentation) {
+ injectInstrumentation(instrumentation);
+ }
+
+ /**
* Inheritors can access the instrumentation using this.
* @return instrumentation
*/
diff --git a/core/java/android/test/InstrumentationTestSuite.java b/core/java/android/test/InstrumentationTestSuite.java
index 2ab949e..7a78ffb 100644
--- a/core/java/android/test/InstrumentationTestSuite.java
+++ b/core/java/android/test/InstrumentationTestSuite.java
@@ -65,7 +65,7 @@
public void runTest(Test test, TestResult result) {
if (test instanceof InstrumentationTestCase) {
- ((InstrumentationTestCase) test).injectInsrumentation(mInstrumentation);
+ ((InstrumentationTestCase) test).injectInstrumentation(mInstrumentation);
}
// run the test as usual
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/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/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/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/com/android/internal/widget/ContactHeaderWidget.java b/core/java/com/android/internal/widget/ContactHeaderWidget.java
index 9e487776..8bae3e4 100644
--- a/core/java/com/android/internal/widget/ContactHeaderWidget.java
+++ b/core/java/com/android/internal/widget/ContactHeaderWidget.java
@@ -39,6 +39,7 @@
import android.provider.ContactsContract.PhoneLookup;
import android.provider.ContactsContract.Presence;
import android.provider.ContactsContract.RawContacts;
+import android.provider.ContactsContract.CommonDataKinds.Email;
import android.provider.ContactsContract.CommonDataKinds.Photo;
import android.provider.SocialContract.Activities;
import android.util.AttributeSet;
@@ -347,9 +348,8 @@
public void bindFromEmail(String emailAddress) {
Cursor c = null;
try {
- c = mContentResolver.query(Uri.withAppendedPath(
- RawContacts.CONTENT_FILTER_EMAIL_URI, Uri.encode(emailAddress)),
- EMAIL_LOOKUP_PROJECTION, null, null, null);
+ c = mContentResolver.query(Uri.withAppendedPath(Email.CONTENT_FILTER_EMAIL_URI, Uri
+ .encode(emailAddress)), EMAIL_LOOKUP_PROJECTION, null, null, null);
if (c != null && c.moveToFirst()) {
long contactId = c.getLong(EMAIL_LOOKUP_CONTACT_ID_COLUMN_INDEX);
bindFromContactId(contactId);
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java
index f0b311c..58056bd 100644
--- a/core/java/com/android/internal/widget/LockPatternUtils.java
+++ b/core/java/com/android/internal/widget/LockPatternUtils.java
@@ -316,20 +316,14 @@
/**
* Set the state of whether the device is permanently locked, meaning the user
- * must authenticate via other means. If false, that means the user has gone
- * out of permanent lock, so the existing (forgotten) lock pattern needs to
- * be cleared.
+ * must authenticate via other means.
+ *
* @param locked Whether the user is permanently locked out until they verify their
* credentials. Occurs after {@link #FAILED_ATTEMPTS_BEFORE_RESET} failed
* attempts.
*/
public void setPermanentlyLocked(boolean locked) {
setBoolean(LOCKOUT_PERMANENT_KEY, locked);
-
- if (!locked) {
- setLockPatternEnabled(false);
- saveLockPattern(null);
- }
}
/**
diff --git a/core/jni/android/graphics/Typeface.cpp b/core/jni/android/graphics/Typeface.cpp
index 21dde63..238ece1 100644
--- a/core/jni/android/graphics/Typeface.cpp
+++ b/core/jni/android/graphics/Typeface.cpp
@@ -141,6 +141,25 @@
return SkTypeface::CreateFromFile(str.c_str());
}
+#define MIN_GAMMA (0.1f)
+#define MAX_GAMMA (10.0f)
+static float pinGamma(float gamma) {
+ if (gamma < MIN_GAMMA) {
+ gamma = MIN_GAMMA;
+ } else if (gamma > MAX_GAMMA) {
+ gamma = MAX_GAMMA;
+ }
+ return gamma;
+}
+
+extern void skia_set_text_gamma(float, float);
+
+static void Typeface_setGammaForText(JNIEnv* env, jobject, jfloat blackGamma,
+ jfloat whiteGamma) {
+ // Comment this out for release builds. This is only used during development
+ skia_set_text_gamma(pinGamma(blackGamma), pinGamma(whiteGamma));
+}
+
///////////////////////////////////////////////////////////////////////////////
static JNINativeMethod gTypefaceMethods[] = {
@@ -151,7 +170,8 @@
{ "nativeCreateFromAsset", "(Landroid/content/res/AssetManager;Ljava/lang/String;)I",
(void*)Typeface_createFromAsset },
{ "nativeCreateFromFile", "(Ljava/lang/String;)I",
- (void*)Typeface_createFromFile }
+ (void*)Typeface_createFromFile },
+ { "setGammaForText", "(FF)V", (void*)Typeface_setGammaForText },
};
int register_android_graphics_Typeface(JNIEnv* env);
diff --git a/core/jni/android_server_BluetoothA2dpService.cpp b/core/jni/android_server_BluetoothA2dpService.cpp
index 14da1fd..a185d8d 100644
--- a/core/jni/android_server_BluetoothA2dpService.cpp
+++ b/core/jni/android_server_BluetoothA2dpService.cpp
@@ -211,10 +211,6 @@
method_onSinkPropertyChanged,
env->NewStringUTF(c_path),
str_array);
- for (int i = 0; i < env->GetArrayLength(str_array); i++) {
- env->DeleteLocalRef(env->GetObjectArrayElement(str_array, i));
- }
- env->DeleteLocalRef(str_array);
result = DBUS_HANDLER_RESULT_HANDLED;
return result;
} else {
diff --git a/core/jni/android_server_BluetoothEventLoop.cpp b/core/jni/android_server_BluetoothEventLoop.cpp
index 527bf07..1bfabd7 100644
--- a/core/jni/android_server_BluetoothEventLoop.cpp
+++ b/core/jni/android_server_BluetoothEventLoop.cpp
@@ -57,6 +57,8 @@
typedef event_loop_native_data_t native_data_t;
+#define EVENT_LOOP_REFS 10
+
static inline native_data_t * get_native_data(JNIEnv *env, jobject object) {
return (native_data_t *)(env->GetIntField(object,
field_mNativeData));
@@ -679,6 +681,7 @@
native_data_t *nat;
JNIEnv *env;
DBusError err;
+ DBusHandlerResult ret;
dbus_error_init(&err);
@@ -694,6 +697,7 @@
dbus_message_get_interface(msg), dbus_message_get_member(msg),
dbus_message_get_path(msg));
+ env->PushLocalFrame(EVENT_LOOP_REFS);
if (dbus_message_is_signal(msg,
"org.bluez.Adapter",
"DeviceFound")) {
@@ -711,10 +715,9 @@
method_onDeviceFound,
env->NewStringUTF(c_address),
str_array);
- env->DeleteLocalRef(str_array);
} else
LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, msg);
- return DBUS_HANDLER_RESULT_HANDLED;
+ goto success;
} else if (dbus_message_is_signal(msg,
"org.bluez.Adapter",
"DeviceDisappeared")) {
@@ -726,7 +729,7 @@
env->CallVoidMethod(nat->me, method_onDeviceDisappeared,
env->NewStringUTF(c_address));
} else LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, msg);
- return DBUS_HANDLER_RESULT_HANDLED;
+ goto success;
} else if (dbus_message_is_signal(msg,
"org.bluez.Adapter",
"DeviceCreated")) {
@@ -739,7 +742,7 @@
method_onDeviceCreated,
env->NewStringUTF(c_object_path));
} else LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, msg);
- return DBUS_HANDLER_RESULT_HANDLED;
+ goto success;
} else if (dbus_message_is_signal(msg,
"org.bluez.Adapter",
"DeviceRemoved")) {
@@ -752,8 +755,7 @@
method_onDeviceRemoved,
env->NewStringUTF(c_object_path));
} else LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, msg);
-
- return DBUS_HANDLER_RESULT_HANDLED;
+ goto success;
} else if (dbus_message_is_signal(msg,
"org.bluez.Adapter",
"PropertyChanged")) {
@@ -775,9 +777,8 @@
env->CallVoidMethod(nat->me,
method_onPropertyChanged,
str_array);
- env->DeleteLocalRef(str_array);
} else LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, msg);
- return DBUS_HANDLER_RESULT_HANDLED;
+ goto success;
} else if (dbus_message_is_signal(msg,
"org.bluez.Device",
"PropertyChanged")) {
@@ -788,12 +789,17 @@
method_onDevicePropertyChanged,
env->NewStringUTF(remote_device_path),
str_array);
- env->DeleteLocalRef(str_array);
} else LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, msg);
- return DBUS_HANDLER_RESULT_HANDLED;
-
+ goto success;
}
- return a2dp_event_filter(msg, env);
+
+ ret = a2dp_event_filter(msg, env);
+ env->PopLocalFrame(NULL);
+ return ret;
+
+success:
+ env->PopLocalFrame(NULL);
+ return DBUS_HANDLER_RESULT_HANDLED;
}
// Called by dbus during WaitForAndDispatchEventNative()
@@ -811,6 +817,8 @@
if (nat == NULL) return DBUS_HANDLER_RESULT_HANDLED;
nat->vm->GetEnv((void**)&env, nat->envVer);
+ env->PushLocalFrame(EVENT_LOOP_REFS);
+
if (dbus_message_is_method_call(msg,
"org.bluez.Agent", "Cancel")) {
@@ -820,11 +828,11 @@
DBusMessage *reply = dbus_message_new_method_return(msg);
if (!reply) {
LOGE("%s: Cannot create message reply\n", __FUNCTION__);
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ goto failure;
}
dbus_connection_send(nat->conn, reply, NULL);
dbus_message_unref(reply);
- return DBUS_HANDLER_RESULT_HANDLED;
+ goto success;
} else if (dbus_message_is_method_call(msg,
"org.bluez.Agent", "Authorize")) {
@@ -835,7 +843,7 @@
DBUS_TYPE_STRING, &uuid,
DBUS_TYPE_INVALID)) {
LOGE("%s: Invalid arguments for Authorize() method", __FUNCTION__);
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ goto failure;
}
LOGV("... object_path = %s", object_path);
@@ -850,7 +858,7 @@
DBusMessage *reply = dbus_message_new_method_return(msg);
if (!reply) {
LOGE("%s: Cannot create message reply\n", __FUNCTION__);
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ goto failure;
}
dbus_connection_send(nat->conn, reply, NULL);
dbus_message_unref(reply);
@@ -859,12 +867,12 @@
"org.bluez.Error.Rejected", "Authorization rejected");
if (!reply) {
LOGE("%s: Cannot create message reply\n", __FUNCTION__);
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ goto failure;
}
dbus_connection_send(nat->conn, reply, NULL);
dbus_message_unref(reply);
}
- return DBUS_HANDLER_RESULT_HANDLED;
+ goto success;
} else if (dbus_message_is_method_call(msg,
"org.bluez.Agent", "RequestPinCode")) {
char *object_path;
@@ -872,14 +880,14 @@
DBUS_TYPE_OBJECT_PATH, &object_path,
DBUS_TYPE_INVALID)) {
LOGE("%s: Invalid arguments for RequestPinCode() method", __FUNCTION__);
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ goto failure;
}
dbus_message_ref(msg); // increment refcount because we pass to java
env->CallVoidMethod(nat->me, method_onRequestPinCode,
env->NewStringUTF(object_path),
int(msg));
- return DBUS_HANDLER_RESULT_HANDLED;
+ goto success;
} else if (dbus_message_is_method_call(msg,
"org.bluez.Agent", "RequestPasskey")) {
char *object_path;
@@ -887,13 +895,14 @@
DBUS_TYPE_OBJECT_PATH, &object_path,
DBUS_TYPE_INVALID)) {
LOGE("%s: Invalid arguments for RequestPasskey() method", __FUNCTION__);
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ goto failure;
}
dbus_message_ref(msg); // increment refcount because we pass to java
env->CallVoidMethod(nat->me, method_onRequestPasskey,
env->NewStringUTF(object_path),
int(msg));
+ goto success;
} else if (dbus_message_is_method_call(msg,
"org.bluez.Agent", "RequestConfirmation")) {
char *object_path;
@@ -903,7 +912,7 @@
DBUS_TYPE_UINT32, &passkey,
DBUS_TYPE_INVALID)) {
LOGE("%s: Invalid arguments for RequestConfirmation() method", __FUNCTION__);
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ goto failure;
}
dbus_message_ref(msg); // increment refcount because we pass to java
@@ -911,23 +920,30 @@
env->NewStringUTF(object_path),
passkey,
int(msg));
- return DBUS_HANDLER_RESULT_HANDLED;
+ goto success;
} else if (dbus_message_is_method_call(msg,
"org.bluez.Agent", "Release")) {
// reply
DBusMessage *reply = dbus_message_new_method_return(msg);
if (!reply) {
LOGE("%s: Cannot create message reply\n", __FUNCTION__);
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ goto failure;
}
dbus_connection_send(nat->conn, reply, NULL);
dbus_message_unref(reply);
- return DBUS_HANDLER_RESULT_HANDLED;
+ goto success;
} else {
LOGV("%s:%s is ignored", dbus_message_get_interface(msg), dbus_message_get_member(msg));
}
+failure:
+ env->PopLocalFrame(NULL);
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+success:
+ env->PopLocalFrame(NULL);
+ return DBUS_HANDLER_RESULT_HANDLED;
+
}
#endif
diff --git a/core/jni/android_server_BluetoothService.cpp b/core/jni/android_server_BluetoothService.cpp
index 326052b..d1901b4 100644
--- a/core/jni/android_server_BluetoothService.cpp
+++ b/core/jni/android_server_BluetoothService.cpp
@@ -46,6 +46,7 @@
namespace android {
#define BLUETOOTH_CLASS_ERROR 0xFF000000
+#define PROPERTIES_NREFS 10
#ifdef HAVE_BLUETOOTH
// We initialize these variables when we load class
@@ -576,11 +577,16 @@
LOGE("DBus reply is NULL in function %s", __FUNCTION__);
return NULL;
}
+ env->PushLocalFrame(PROPERTIES_NREFS);
+
DBusMessageIter iter;
jobjectArray str_array = NULL;
if (dbus_message_iter_init(reply, &iter))
str_array = parse_remote_device_properties(env, &iter);
dbus_message_unref(reply);
+
+ env->PopLocalFrame(NULL);
+
return str_array;
}
#endif
@@ -607,11 +613,15 @@
LOGE("DBus reply is NULL in function %s", __FUNCTION__);
return NULL;
}
+ env->PushLocalFrame(PROPERTIES_NREFS);
+
DBusMessageIter iter;
jobjectArray str_array = NULL;
if (dbus_message_iter_init(reply, &iter))
str_array = parse_adapter_properties(env, &iter);
dbus_message_unref(reply);
+
+ env->PopLocalFrame(NULL);
return str_array;
}
#endif
diff --git a/core/res/res/layout/keyguard_screen_glogin_unlock.xml b/core/res/res/layout/keyguard_screen_glogin_unlock.xml
index 74ff3b0..6e00d11 100644
--- a/core/res/res/layout/keyguard_screen_glogin_unlock.xml
+++ b/core/res/res/layout/keyguard_screen_glogin_unlock.xml
@@ -42,7 +42,6 @@
android:gravity="center_vertical"
android:drawableLeft="@drawable/ic_lock_idle_lock"
android:drawablePadding="5dip"
- android:text="@android:string/lockscreen_glogin_too_many_attempts"
/>
<!-- spacer below header -->
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index c14ecc0..073be4f 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -1294,7 +1294,11 @@
their lock gesture -->
<string name="lockscreen_forgot_pattern_button_text">Forgot pattern?</string>
- <!-- Title of the unlock screen that uses your Google login and password -->
+ <!-- Title of the unlock screen that uses your Google login and password when the user hit
+ the 'forgot pattern' button.-->
+ <string name="lockscreen_glogin_forgot_pattern">Account unlock</string>
+ <!-- Title of the unlock screen that uses your Google login and password when the user attempted
+ too many patterns and we are forcing them to use their account instead. -->
<string name="lockscreen_glogin_too_many_attempts">Too many pattern attempts!</string>
<!-- In the unlock screen, message telling the user that they need to use their Google login and password to unlock the phone -->
<string name="lockscreen_glogin_instructions">To unlock, sign in with your Google account</string>
@@ -1307,6 +1311,9 @@
<!-- Displayed to the user when unlocking the phone with a username and password fails. -->
<string name="lockscreen_glogin_invalid_input">Invalid username or password.</string>
+ <!-- Displayed in a progress dialog while a username and password are being checked. -->
+ <string name="lockscreen_glogin_checking_password">Checking...</string>
+
<!-- A format string for 12-hour time of day, just the hour, not the minute, with lower-case "am" or "pm" (example: "3pm"). -->
<string name="hour_ampm">"<xliff:g id="hour" example="3">%-l</xliff:g><xliff:g id="ampm" example="pm">%P</xliff:g>"</string>
diff --git a/graphics/java/android/graphics/Typeface.java b/graphics/java/android/graphics/Typeface.java
index e40e84a..9bcab72 100644
--- a/graphics/java/android/graphics/Typeface.java
+++ b/graphics/java/android/graphics/Typeface.java
@@ -172,4 +172,14 @@
private static native int nativeGetStyle(int native_instance);
private static native int nativeCreateFromAsset(AssetManager mgr, String path);
private static native int nativeCreateFromFile(String path);
+
+ /**
+ * Set the global gamma coefficients for black and white text. This call is
+ * usually a no-op in shipping products, and only exists for testing during
+ * development.
+ *
+ * @param blackGamma gamma coefficient for black text
+ * @param whiteGamma gamma coefficient for white text
+ */
+ public static native void setGammaForText(float blackGamma, float whiteGamma);
}
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/renderscript/RSSurfaceView.java b/graphics/java/android/renderscript/RSSurfaceView.java
index a4be171..792b98d 100644
--- a/graphics/java/android/renderscript/RSSurfaceView.java
+++ b/graphics/java/android/renderscript/RSSurfaceView.java
@@ -141,15 +141,12 @@
// ----------------------------------------------------------------------
- public RenderScript createRenderScript() {
- Log.v(RenderScript.LOG_TAG, "createRenderScript 1");
+ public RenderScript createRenderScript(boolean useDepth) {
Surface sur = null;
while ((sur == null) || (mSurfaceHolder == null)) {
sur = getHolder().getSurface();
}
- Log.v(RenderScript.LOG_TAG, "createRenderScript 2");
- RenderScript rs = new RenderScript(sur);
- Log.v(RenderScript.LOG_TAG, "createRenderScript 3 rs");
+ RenderScript rs = new RenderScript(sur, useDepth);
return rs;
}
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java
index 1bdabe7..01926e9 100644
--- a/graphics/java/android/renderscript/RenderScript.java
+++ b/graphics/java/android/renderscript/RenderScript.java
@@ -60,7 +60,7 @@
native int nDeviceCreate();
native void nDeviceDestroy(int dev);
- native int nContextCreate(int dev, Surface sur, int ver);
+ native int nContextCreate(int dev, Surface sur, int ver, boolean useDepth);
native void nContextDestroy(int con);
//void rsContextBindSampler (uint32_t slot, RsSampler sampler);
@@ -194,10 +194,10 @@
///////////////////////////////////////////////////////////////////////////////////
//
- public RenderScript(Surface sur) {
+ public RenderScript(Surface sur, boolean useDepth) {
mSurface = sur;
mDev = nDeviceCreate();
- mContext = nContextCreate(mDev, mSurface, 0);
+ mContext = nContextCreate(mDev, mSurface, 0, useDepth);
// TODO: This should be protected by a lock
if(!mElementsInitialized) {
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp
index fede0e50..2393f74 100644
--- a/graphics/jni/android_renderscript_RenderScript.cpp
+++ b/graphics/jni/android_renderscript_RenderScript.cpp
@@ -126,7 +126,7 @@
}
static jint
-nContextCreate(JNIEnv *_env, jobject _this, jint dev, jobject wnd, jint ver)
+nContextCreate(JNIEnv *_env, jobject _this, jint dev, jobject wnd, jint ver, jboolean useDepth)
{
LOG_API("nContextCreate");
@@ -142,7 +142,7 @@
if (window == NULL)
goto not_valid_surface;
- return (jint)rsContextCreate((RsDevice)dev, window, ver);
+ return (jint)rsContextCreate((RsDevice)dev, window, ver, useDepth);
}
static void
@@ -1206,7 +1206,7 @@
{"_nInit", "()V", (void*)_nInit },
{"nDeviceCreate", "()I", (void*)nDeviceCreate },
{"nDeviceDestroy", "(I)V", (void*)nDeviceDestroy },
-{"nContextCreate", "(ILandroid/view/Surface;I)I", (void*)nContextCreate },
+{"nContextCreate", "(ILandroid/view/Surface;IZ)I", (void*)nContextCreate },
{"nContextDestroy", "(I)V", (void*)nContextDestroy },
{"nAssignName", "(I[B)V", (void*)nAssignName },
{"nObjDestroy", "(I)V", (void*)nObjDestroy },
diff --git a/libs/rs/RenderScript.h b/libs/rs/RenderScript.h
index 2f60c9f..1e24cd2 100644
--- a/libs/rs/RenderScript.h
+++ b/libs/rs/RenderScript.h
@@ -49,7 +49,7 @@
RsDevice rsDeviceCreate();
void rsDeviceDestroy(RsDevice);
-RsContext rsContextCreate(RsDevice, void *, uint32_t version);
+RsContext rsContextCreate(RsDevice, void *, uint32_t version, bool useDepth);
void rsContextDestroy(RsContext);
void rsObjDestroyOOB(RsContext, void *);
diff --git a/libs/rs/java/Fall/src/com/android/fall/rs/FallView.java b/libs/rs/java/Fall/src/com/android/fall/rs/FallView.java
index fa2caa7..7468d2b 100644
--- a/libs/rs/java/Fall/src/com/android/fall/rs/FallView.java
+++ b/libs/rs/java/Fall/src/com/android/fall/rs/FallView.java
@@ -36,7 +36,7 @@
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
super.surfaceChanged(holder, format, w, h);
- RenderScript RS = createRenderScript();
+ RenderScript RS = createRenderScript(false);
mRender = new FallRS(w, h);
mRender.init(RS, getResources());
}
diff --git a/libs/rs/java/Film/src/com/android/film/FilmView.java b/libs/rs/java/Film/src/com/android/film/FilmView.java
index 73b7414..1c5b2bc 100644
--- a/libs/rs/java/Film/src/com/android/film/FilmView.java
+++ b/libs/rs/java/Film/src/com/android/film/FilmView.java
@@ -52,7 +52,7 @@
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
super.surfaceChanged(holder, format, w, h);
- mRS = createRenderScript();
+ mRS = createRenderScript(true);
mRender = new FilmRS();
mRender.init(mRS, getResources(), w, h);
}
diff --git a/libs/rs/java/Fountain/src/com/android/fountain/FountainView.java b/libs/rs/java/Fountain/src/com/android/fountain/FountainView.java
index 2768e2c..7826161 100644
--- a/libs/rs/java/Fountain/src/com/android/fountain/FountainView.java
+++ b/libs/rs/java/Fountain/src/com/android/fountain/FountainView.java
@@ -52,7 +52,7 @@
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
super.surfaceChanged(holder, format, w, h);
- mRS = createRenderScript();
+ mRS = createRenderScript(false);
mRender = new FountainRS();
mRender.init(mRS, getResources(), w, h);
}
diff --git a/libs/rs/java/Rollo/src/com/android/rollo/RolloView.java b/libs/rs/java/Rollo/src/com/android/rollo/RolloView.java
index 3e1c54d..7524a0e 100644
--- a/libs/rs/java/Rollo/src/com/android/rollo/RolloView.java
+++ b/libs/rs/java/Rollo/src/com/android/rollo/RolloView.java
@@ -54,7 +54,7 @@
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
super.surfaceChanged(holder, format, w, h);
- mRS = createRenderScript();
+ mRS = createRenderScript(false);
mRender = new RolloRS();
mRender.init(mRS, getResources(), w, h);
}
diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp
index 413caab..c8c69a8 100644
--- a/libs/rs/rsContext.cpp
+++ b/libs/rs/rsContext.cpp
@@ -18,6 +18,7 @@
#include "rsContext.h"
#include "rsThreadIO.h"
#include <ui/FramebufferNativeWindow.h>
+#include <ui/EGLUtils.h>
#include <GLES/gl.h>
#include <GLES/glext.h>
@@ -29,41 +30,64 @@
void Context::initEGL()
{
- mNumConfigs = -1;
+ mEGL.mNumConfigs = -1;
+ EGLint configAttribs[128];
+ EGLint *configAttribsPtr = configAttribs;
- EGLint s_configAttribs[] = {
- EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
-#if 1
- EGL_RED_SIZE, 8,
- EGL_GREEN_SIZE, 8,
- EGL_BLUE_SIZE, 8,
- EGL_ALPHA_SIZE, 8,
-#else
- EGL_RED_SIZE, 5,
- EGL_GREEN_SIZE, 6,
- EGL_BLUE_SIZE, 5,
-#endif
- EGL_DEPTH_SIZE, 16,
- EGL_NONE
- };
+ memset(configAttribs, 0, sizeof(configAttribs));
- mDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- eglInitialize(mDisplay, &mMajorVersion, &mMinorVersion);
- eglChooseConfig(mDisplay, s_configAttribs, &mConfig, 1, &mNumConfigs);
+ configAttribsPtr[0] = EGL_SURFACE_TYPE;
+ configAttribsPtr[1] = EGL_WINDOW_BIT;
+ configAttribsPtr += 2;
- if (mWndSurface) {
- mSurface = eglCreateWindowSurface(mDisplay, mConfig, mWndSurface,
- NULL);
- } else {
- mSurface = eglCreateWindowSurface(mDisplay, mConfig,
- android_createDisplaySurface(),
- NULL);
- }
+ if (mUseDepth) {
+ configAttribsPtr[0] = EGL_DEPTH_SIZE;
+ configAttribsPtr[1] = 16;
+ configAttribsPtr += 2;
+ }
+ configAttribsPtr[0] = EGL_NONE;
+ rsAssert(configAttribsPtr < (configAttribs + (sizeof(configAttribs) / sizeof(EGLint))));
- mContext = eglCreateContext(mDisplay, mConfig, NULL, NULL);
- eglMakeCurrent(mDisplay, mSurface, mSurface, mContext);
- eglQuerySurface(mDisplay, mSurface, EGL_WIDTH, &mWidth);
- eglQuerySurface(mDisplay, mSurface, EGL_HEIGHT, &mHeight);
+ mEGL.mDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
+ eglInitialize(mEGL.mDisplay, &mEGL.mMajorVersion, &mEGL.mMinorVersion);
+
+ status_t err = EGLUtils::selectConfigForNativeWindow(mEGL.mDisplay, configAttribs, mWndSurface, &mEGL.mConfig);
+ if (err) {
+ LOGE("couldn't find an EGLConfig matching the screen format\n");
+ }
+ //eglChooseConfig(mEGL.mDisplay, configAttribs, &mEGL.mConfig, 1, &mEGL.mNumConfigs);
+
+ if (mWndSurface) {
+ mEGL.mSurface = eglCreateWindowSurface(mEGL.mDisplay, mEGL.mConfig, mWndSurface, NULL);
+ } else {
+ mEGL.mSurface = eglCreateWindowSurface(mEGL.mDisplay, mEGL.mConfig,
+ android_createDisplaySurface(),
+ NULL);
+ }
+
+ mEGL.mContext = eglCreateContext(mEGL.mDisplay, mEGL.mConfig, NULL, NULL);
+ eglMakeCurrent(mEGL.mDisplay, mEGL.mSurface, mEGL.mSurface, mEGL.mContext);
+ eglQuerySurface(mEGL.mDisplay, mEGL.mSurface, EGL_WIDTH, &mEGL.mWidth);
+ eglQuerySurface(mEGL.mDisplay, mEGL.mSurface, EGL_HEIGHT, &mEGL.mHeight);
+
+
+ mGL.mVersion = glGetString(GL_VERSION);
+ mGL.mVendor = glGetString(GL_VENDOR);
+ mGL.mRenderer = glGetString(GL_RENDERER);
+ mGL.mExtensions = glGetString(GL_EXTENSIONS);
+
+ LOGV("EGL Version %i %i", mEGL.mMajorVersion, mEGL.mMinorVersion);
+ LOGV("GL Version %s", mGL.mVersion);
+ LOGV("GL Vendor %s", mGL.mVendor);
+ LOGV("GL Renderer %s", mGL.mRenderer);
+ LOGV("GL Extensions %s", mGL.mExtensions);
+
+ if (memcmp(mGL.mVersion, "OpenGL ES-CM", 12)) {
+ LOGE("Error, OpenGL ES Lite not supported");
+ }
+ sscanf((const char *)mGL.mVersion + 13, "%i.%i", &mGL.mMajorVersion, &mGL.mMinorVersion);
+
+
}
bool Context::runScript(Script *s, uint32_t launchID)
@@ -90,19 +114,22 @@
//glColor4f(1,1,1,1);
//glEnable(GL_LIGHT0);
- glViewport(0, 0, mWidth, mHeight);
-
- glDepthMask(GL_TRUE);
+ glViewport(0, 0, mEGL.mWidth, mEGL.mHeight);
+#if 1
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glClearColor(mRootScript->mEnviroment.mClearColor[0],
mRootScript->mEnviroment.mClearColor[1],
mRootScript->mEnviroment.mClearColor[2],
mRootScript->mEnviroment.mClearColor[3]);
- glClearDepthf(mRootScript->mEnviroment.mClearDepth);
- glClear(GL_COLOR_BUFFER_BIT);
- glClear(GL_DEPTH_BUFFER_BIT);
-
+ if (mUseDepth) {
+ glDepthMask(GL_TRUE);
+ glClearDepthf(mRootScript->mEnviroment.mClearDepth);
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ } else {
+ glClear(GL_COLOR_BUFFER_BIT);
+ }
+#endif
#if RS_LOG_TIMES
timerSet(RS_TIMER_SCRIPT);
#endif
@@ -156,13 +183,13 @@
void Context::setupCheck()
{
if (mFragmentStore.get()) {
- mFragmentStore->setupGL(&mStateFragmentStore);
+ mFragmentStore->setupGL(this, &mStateFragmentStore);
}
if (mFragment.get()) {
- mFragment->setupGL(&mStateFragment);
+ mFragment->setupGL(this, &mStateFragment);
}
if (mVertex.get()) {
- mVertex->setupGL(&mStateVertex);
+ mVertex->setupGL(this, &mStateVertex);
}
}
@@ -186,11 +213,11 @@
LOGE("pthread_setspecific %i", status);
}
- rsc->mStateVertex.init(rsc, rsc->mWidth, rsc->mHeight);
+ rsc->mStateVertex.init(rsc, rsc->mEGL.mWidth, rsc->mEGL.mHeight);
rsc->setVertex(NULL);
- rsc->mStateFragment.init(rsc, rsc->mWidth, rsc->mHeight);
+ rsc->mStateFragment.init(rsc, rsc->mEGL.mWidth, rsc->mEGL.mHeight);
rsc->setFragment(NULL);
- rsc->mStateFragmentStore.init(rsc, rsc->mWidth, rsc->mHeight);
+ rsc->mStateFragmentStore.init(rsc, rsc->mEGL.mWidth, rsc->mEGL.mHeight);
rsc->setFragmentStore(NULL);
rsc->mRunning = true;
@@ -204,7 +231,7 @@
#if RS_LOG_TIMES
rsc->timerSet(RS_TIMER_CLEAR_SWAP);
#endif
- eglSwapBuffers(rsc->mDisplay, rsc->mSurface);
+ eglSwapBuffers(rsc->mEGL.mDisplay, rsc->mEGL.mSurface);
#if RS_LOG_TIMES
rsc->timerSet(RS_TIMER_INTERNAL);
rsc->timerPrint();
@@ -218,18 +245,19 @@
glClearColor(0,0,0,0);
glClear(GL_COLOR_BUFFER_BIT);
- eglSwapBuffers(rsc->mDisplay, rsc->mSurface);
- eglTerminate(rsc->mDisplay);
+ eglSwapBuffers(rsc->mEGL.mDisplay, rsc->mEGL.mSurface);
+ eglTerminate(rsc->mEGL.mDisplay);
rsc->objDestroyOOBRun();
return NULL;
}
-Context::Context(Device *dev, Surface *sur)
+Context::Context(Device *dev, Surface *sur, bool useDepth)
{
dev->addContext(this);
mDev = dev;
mRunning = false;
mExit = false;
+ mUseDepth = useDepth;
int status;
pthread_attr_t threadAttr;
@@ -284,17 +312,6 @@
objDestroyOOBDestroy();
}
-void Context::swapBuffers()
-{
- eglSwapBuffers(mDisplay, mSurface);
-}
-
-void rsContextSwap(RsContext vrsc)
-{
- Context *rsc = static_cast<Context *>(vrsc);
- rsc->swapBuffers();
-}
-
void Context::setRootScript(Script *s)
{
mRootScript.set(s);
@@ -520,10 +537,10 @@
}
-RsContext rsContextCreate(RsDevice vdev, void *sur, uint32_t version)
+RsContext rsContextCreate(RsDevice vdev, void *sur, uint32_t version, bool useDepth)
{
Device * dev = static_cast<Device *>(vdev);
- Context *rsc = new Context(dev, (Surface *)sur);
+ Context *rsc = new Context(dev, (Surface *)sur, useDepth);
return rsc;
}
diff --git a/libs/rs/rsContext.h b/libs/rs/rsContext.h
index ca67e40..c58a88c 100644
--- a/libs/rs/rsContext.h
+++ b/libs/rs/rsContext.h
@@ -49,7 +49,7 @@
class Context
{
public:
- Context(Device *, Surface *);
+ Context(Device *, Surface *, bool useDepth);
~Context();
static pthread_key_t gThreadTLSKey;
@@ -111,8 +111,8 @@
mFloatDefines.add(String8(name), value);
}
- uint32_t getWidth() const {return mWidth;}
- uint32_t getHeight() const {return mHeight;}
+ uint32_t getWidth() const {return mEGL.mWidth;}
+ uint32_t getHeight() const {return mEGL.mHeight;}
ThreadIO mIO;
@@ -132,21 +132,38 @@
void timerSet(Timers);
void timerPrint();
+ bool checkVersion1_1() const {return (mGL.mMajorVersion > 1) || (mGL.mMinorVersion >= 1); }
+ bool checkVersion2_0() const {return mGL.mMajorVersion >= 2; }
+
protected:
Device *mDev;
- EGLint mNumConfigs;
- EGLint mMajorVersion;
- EGLint mMinorVersion;
- EGLConfig mConfig;
- EGLContext mContext;
- EGLSurface mSurface;
- EGLint mWidth;
- EGLint mHeight;
- EGLDisplay mDisplay;
+ struct {
+ EGLint mNumConfigs;
+ EGLint mMajorVersion;
+ EGLint mMinorVersion;
+ EGLConfig mConfig;
+ EGLContext mContext;
+ EGLSurface mSurface;
+ EGLint mWidth;
+ EGLint mHeight;
+ EGLDisplay mDisplay;
+ } mEGL;
+
+ struct {
+ const uint8_t * mVendor;
+ const uint8_t * mRenderer;
+ const uint8_t * mVersion;
+ const uint8_t * mExtensions;
+
+ uint32_t mMajorVersion;
+ uint32_t mMinorVersion;
+
+ } mGL;
bool mRunning;
bool mExit;
+ bool mUseDepth;
pthread_t mThreadId;
diff --git a/libs/rs/rsObjectBase.cpp b/libs/rs/rsObjectBase.cpp
index 6a5b7d8..07bbc1e 100644
--- a/libs/rs/rsObjectBase.cpp
+++ b/libs/rs/rsObjectBase.cpp
@@ -43,6 +43,11 @@
mRefCount --;
//LOGV("ObjectBase %p dec ref %i", this, mRefCount);
if (!mRefCount) {
+ if (mName) {
+ LOGV("Deleting RS object %p, name %s", this, mName);
+ } else {
+ LOGV("Deleting RS object %p, no name", this);
+ }
delete this;
}
}
diff --git a/libs/rs/rsProgram.cpp b/libs/rs/rsProgram.cpp
index 6606daa..18eacfb 100644
--- a/libs/rs/rsProgram.cpp
+++ b/libs/rs/rsProgram.cpp
@@ -47,9 +47,3 @@
}
}
-void Program::setupGL()
-{
-
-}
-
-
diff --git a/libs/rs/rsProgram.h b/libs/rs/rsProgram.h
index 251072fb..bb3d9ac 100644
--- a/libs/rs/rsProgram.h
+++ b/libs/rs/rsProgram.h
@@ -32,11 +32,7 @@
Program(Element *in, Element *out);
virtual ~Program();
-
void bindAllocation(Allocation *);
-
- virtual void setupGL();
-
void checkUpdatedAllocation(const Allocation *);
protected:
diff --git a/libs/rs/rsProgramFragment.cpp b/libs/rs/rsProgramFragment.cpp
index 4ef6835..654974f 100644
--- a/libs/rs/rsProgramFragment.cpp
+++ b/libs/rs/rsProgramFragment.cpp
@@ -40,7 +40,7 @@
{
}
-void ProgramFragment::setupGL(ProgramFragmentState *state)
+void ProgramFragment::setupGL(const Context *rsc, ProgramFragmentState *state)
{
if ((state->mLast.get() == this) && !mDirty) {
return;
@@ -55,7 +55,9 @@
}
glEnable(GL_TEXTURE_2D);
- //glTexEnvi(GL_POINT_SPRITE_OES, GL_COORD_REPLACE_OES, mPointSpriteEnable);
+ if (rsc->checkVersion1_1()) {
+ glTexEnvi(GL_POINT_SPRITE_OES, GL_COORD_REPLACE_OES, mPointSpriteEnable);
+ }
glBindTexture(GL_TEXTURE_2D, mTextures[ct]->getTextureID());
switch(mEnvModes[ct]) {
diff --git a/libs/rs/rsProgramFragment.h b/libs/rs/rsProgramFragment.h
index bd45342..51117eb 100644
--- a/libs/rs/rsProgramFragment.h
+++ b/libs/rs/rsProgramFragment.h
@@ -35,7 +35,7 @@
ProgramFragment(Element *in, Element *out, bool pointSpriteEnable);
virtual ~ProgramFragment();
- virtual void setupGL(ProgramFragmentState *);
+ virtual void setupGL(const Context *, ProgramFragmentState *);
diff --git a/libs/rs/rsProgramFragmentStore.cpp b/libs/rs/rsProgramFragmentStore.cpp
index 99eed16..36ec615 100644
--- a/libs/rs/rsProgramFragmentStore.cpp
+++ b/libs/rs/rsProgramFragmentStore.cpp
@@ -48,7 +48,7 @@
{
}
-void ProgramFragmentStore::setupGL(ProgramFragmentStoreState *state)
+void ProgramFragmentStore::setupGL(const Context *rsc, ProgramFragmentStoreState *state)
{
if (state->mLast.get() == this) {
return;
diff --git a/libs/rs/rsProgramFragmentStore.h b/libs/rs/rsProgramFragmentStore.h
index 0de5c3a..e646e03 100644
--- a/libs/rs/rsProgramFragmentStore.h
+++ b/libs/rs/rsProgramFragmentStore.h
@@ -31,7 +31,7 @@
ProgramFragmentStore(Element *in, Element *out);
virtual ~ProgramFragmentStore();
- virtual void setupGL(ProgramFragmentStoreState *);
+ virtual void setupGL(const Context *, ProgramFragmentStoreState *);
void setDepthFunc(RsDepthFunc);
void setDepthMask(bool);
diff --git a/libs/rs/rsProgramVertex.cpp b/libs/rs/rsProgramVertex.cpp
index 6ef5456..dc57d34 100644
--- a/libs/rs/rsProgramVertex.cpp
+++ b/libs/rs/rsProgramVertex.cpp
@@ -44,7 +44,7 @@
LOGV("%6.2f, %6.2f, %6.2f, %6.2f", f[3], f[7], f[11], f[15]);
}
-void ProgramVertex::setupGL(ProgramVertexState *state)
+void ProgramVertex::setupGL(const Context *rsc, ProgramVertexState *state)
{
if ((state->mLast.get() == this) && !mDirty) {
return;
diff --git a/libs/rs/rsProgramVertex.h b/libs/rs/rsProgramVertex.h
index c9ce7aa..523c3ed 100644
--- a/libs/rs/rsProgramVertex.h
+++ b/libs/rs/rsProgramVertex.h
@@ -33,7 +33,7 @@
ProgramVertex(Element *in, Element *out);
virtual ~ProgramVertex();
- virtual void setupGL(ProgramVertexState *state);
+ virtual void setupGL(const Context *rsc, ProgramVertexState *state);
void setTextureMatrixEnable(bool e) {mTextureMatrixEnable = e;}
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..9bb00c6 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 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 dcb8c43..ea42f53 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPlayerApiTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPlayerApiTest.java
@@ -435,13 +435,6 @@
@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/opengl/libs/Android.mk b/opengl/libs/Android.mk
index e1fd48b..9578452 100644
--- a/opengl/libs/Android.mk
+++ b/opengl/libs/Android.mk
@@ -28,6 +28,10 @@
LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
LOCAL_CFLAGS += -fvisibility=hidden
+ifeq ($(TARGET_BOARD_PLATFORM),msm7k)
+LOCAL_CFLAGS += -DADRENO130=1
+endif
+
include $(BUILD_SHARED_LIBRARY)
installed_libEGL := $(LOCAL_INSTALLED_MODULE)
diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp
index 03e764c..d1ddcd3 100644
--- a/opengl/libs/EGL/egl.cpp
+++ b/opengl/libs/EGL/egl.cpp
@@ -36,6 +36,8 @@
#include <cutils/properties.h>
#include <cutils/memory.h>
+#include <utils/SortedVector.h>
+
#include "hooks.h"
#include "egl_impl.h"
#include "Loader.h"
@@ -63,40 +65,122 @@
// ----------------------------------------------------------------------------
-template <int MAGIC>
-struct egl_object_t
-{
- egl_object_t() : magic(MAGIC) { }
- ~egl_object_t() { magic = 0; }
- bool isValid() const { return magic == MAGIC; }
+class egl_object_t {
+ static SortedVector<egl_object_t*> sObjects;
+ static Mutex sLock;
+
+ volatile int32_t terminated;
+ mutable volatile int32_t count;
+
+public:
+ egl_object_t() : terminated(0), count(1) {
+ Mutex::Autolock _l(sLock);
+ sObjects.add(this);
+ }
+
+ inline bool isAlive() const { return !terminated; }
+
private:
- uint32_t magic;
+ bool get() {
+ Mutex::Autolock _l(sLock);
+ if (egl_object_t::sObjects.indexOf(this) >= 0) {
+ android_atomic_inc(&count);
+ return true;
+ }
+ return false;
+ }
+
+ bool put() {
+ Mutex::Autolock _l(sLock);
+ if (android_atomic_dec(&count) == 1) {
+ sObjects.remove(this);
+ return true;
+ }
+ return false;
+ }
+
+public:
+ template <typename N, typename T>
+ struct LocalRef {
+ N* ref;
+ LocalRef(T o) : ref(0) {
+ N* native = reinterpret_cast<N*>(o);
+ if (o && native->get()) {
+ ref = native;
+ }
+ }
+ ~LocalRef() {
+ if (ref && ref->put()) {
+ delete ref;
+ }
+ }
+ inline N* get() {
+ return ref;
+ }
+ void acquire() const {
+ if (ref) {
+ android_atomic_inc(&ref->count);
+ }
+ }
+ void release() const {
+ if (ref) {
+ int32_t c = android_atomic_dec(&ref->count);
+ // ref->count cannot be 1 prior atomic_dec because we have
+ // a reference, and if we have one, it means there was
+ // already one before us.
+ LOGE_IF(c==1, "refcount is now 0 in release()");
+ }
+ }
+ void terminate() {
+ if (ref) {
+ ref->terminated = 1;
+ release();
+ }
+ }
+ };
};
-struct egl_display_t : public egl_object_t<'_dpy'>
-{
- EGLDisplay dpys[IMPL_NUM_DRIVERS_IMPLEMENTATIONS];
- EGLConfig* configs[IMPL_NUM_DRIVERS_IMPLEMENTATIONS];
- EGLint numConfigs[IMPL_NUM_DRIVERS_IMPLEMENTATIONS];
- EGLint numTotalConfigs;
- char const* extensionsString;
- volatile int32_t refs;
+SortedVector<egl_object_t*> egl_object_t::sObjects;
+Mutex egl_object_t::sLock;
+
+struct egl_display_t {
+ enum { NOT_INITIALIZED, INITIALIZED, TERMINATED };
+
struct strings_t {
char const * vendor;
char const * version;
char const * clientApi;
char const * extensions;
};
- strings_t queryString[IMPL_NUM_DRIVERS_IMPLEMENTATIONS];
+
+ struct DisplayImpl {
+ DisplayImpl() : dpy(EGL_NO_DISPLAY), config(0),
+ state(NOT_INITIALIZED), numConfigs(0) { }
+ EGLDisplay dpy;
+ EGLConfig* config;
+ EGLint state;
+ EGLint numConfigs;
+ strings_t queryString;
+ };
+
+ uint32_t magic;
+ DisplayImpl disp[IMPL_NUM_DRIVERS_IMPLEMENTATIONS];
+ EGLint numTotalConfigs;
+ volatile int32_t refs;
+
+ egl_display_t() : magic('_dpy'), numTotalConfigs(0) { }
+ ~egl_display_t() { magic = 0; }
+ inline bool isValid() const { return magic == '_dpy'; }
+ inline bool isAlive() const { return isValid(); }
};
-struct egl_surface_t : public egl_object_t<'_srf'>
+struct egl_surface_t : public egl_object_t
{
+ typedef egl_object_t::LocalRef<egl_surface_t, EGLSurface> Ref;
+
egl_surface_t(EGLDisplay dpy, EGLSurface surface,
int impl, egl_connection_t const* cnx)
- : dpy(dpy), surface(surface), impl(impl), cnx(cnx)
- {
- // NOTE: window must be incRef'ed and connected already
+ : dpy(dpy), surface(surface), impl(impl), cnx(cnx) {
}
~egl_surface_t() {
}
@@ -106,8 +190,10 @@
egl_connection_t const* cnx;
};
-struct egl_context_t : public egl_object_t<'_ctx'>
+struct egl_context_t : public egl_object_t
{
+ typedef egl_object_t::LocalRef<egl_context_t, EGLContext> Ref;
+
egl_context_t(EGLDisplay dpy, EGLContext context,
int impl, egl_connection_t const* cnx)
: dpy(dpy), context(context), read(0), draw(0), impl(impl), cnx(cnx)
@@ -121,8 +207,10 @@
egl_connection_t const* cnx;
};
-struct egl_image_t : public egl_object_t<'_img'>
+struct egl_image_t : public egl_object_t
{
+ typedef egl_object_t::LocalRef<egl_image_t, EGLImageKHR> Ref;
+
egl_image_t(EGLDisplay dpy, EGLContext context)
: dpy(dpy), context(context)
{
@@ -133,6 +221,10 @@
EGLImageKHR images[IMPL_NUM_DRIVERS_IMPLEMENTATIONS];
};
+typedef egl_surface_t::Ref SurfaceRef;
+typedef egl_context_t::Ref ContextRef;
+typedef egl_image_t::Ref ImageRef;
+
struct tls_t
{
tls_t() : error(EGL_SUCCESS), ctx(0), logCallWithNoContext(EGL_TRUE) { }
@@ -272,14 +364,14 @@
static EGLint configToUniqueId(egl_display_t const* dp, int i, int index)
{
// NOTE: this mapping works only if we have no more than two EGLimpl
- return (i>0 ? dp->numConfigs[0] : 0) + index;
+ return (i>0 ? dp->disp[0].numConfigs : 0) + index;
}
static void uniqueIdToConfig(egl_display_t const* dp, EGLint configId,
int& i, int& index)
{
// NOTE: this mapping works only if we have no more than two EGLimpl
- size_t numConfigs = dp->numConfigs[0];
+ size_t numConfigs = dp->disp[0].numConfigs;
i = configId / numConfigs;
index = configId % numConfigs;
}
@@ -391,7 +483,7 @@
return setError(EGL_BAD_CONFIG, (egl_connection_t*)NULL);
}
index = uintptr_t(config) & 0xFFFFFF;
- if (index >= dp->numConfigs[impl]) {
+ if (index >= dp->disp[impl].numConfigs) {
return setError(EGL_BAD_CONFIG, (egl_connection_t*)NULL);
}
egl_connection_t* const cnx = &gEGLImpl[impl];
@@ -405,11 +497,9 @@
{
if ((uintptr_t(dpy)-1U) >= NUM_DISPLAYS)
return setError(EGL_BAD_DISPLAY, EGL_FALSE);
- if (!get_display(dpy)->isValid())
+ if (!get_display(dpy)->isAlive())
return setError(EGL_BAD_DISPLAY, EGL_FALSE);
- if (!ctx) // TODO: make sure context is a valid object
- return setError(EGL_BAD_CONTEXT, EGL_FALSE);
- if (!get_context(ctx)->isValid())
+ if (!get_context(ctx)->isAlive())
return setError(EGL_BAD_CONTEXT, EGL_FALSE);
return EGL_TRUE;
}
@@ -418,37 +508,34 @@
{
if ((uintptr_t(dpy)-1U) >= NUM_DISPLAYS)
return setError(EGL_BAD_DISPLAY, EGL_FALSE);
- if (!get_display(dpy)->isValid())
+ if (!get_display(dpy)->isAlive())
return setError(EGL_BAD_DISPLAY, EGL_FALSE);
- if (!surface) // TODO: make sure surface is a valid object
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
- if (!get_surface(surface)->isValid())
+ if (!get_surface(surface)->isAlive())
return setError(EGL_BAD_SURFACE, EGL_FALSE);
return EGL_TRUE;
}
-
EGLImageKHR egl_get_image_for_current_context(EGLImageKHR image)
{
+ ImageRef _i(image);
+ if (!_i.get()) return EGL_NO_IMAGE_KHR;
+
EGLContext context = getContext();
if (context == EGL_NO_CONTEXT || image == EGL_NO_IMAGE_KHR)
return EGL_NO_IMAGE_KHR;
egl_context_t const * const c = get_context(context);
- if (!c->isValid())
+ if (!c->isAlive())
return EGL_NO_IMAGE_KHR;
egl_image_t const * const i = get_image(image);
- if (!i->isValid())
- return EGL_NO_IMAGE_KHR;
-
return i->images[c->impl];
}
// ----------------------------------------------------------------------------
// this mutex protects:
-// d->dpys[]
+// d->disp[]
// egl_init_drivers_locked()
//
static pthread_mutex_t gInitDriverMutex = PTHREAD_MUTEX_INITIALIZER;
@@ -477,7 +564,7 @@
if (cnx->dso) {
EGLDisplay dpy = cnx->hooks->egl.eglGetDisplay(EGL_DEFAULT_DISPLAY);
LOGE_IF(dpy==EGL_NO_DISPLAY, "No EGLDisplay for software EGL!");
- d->dpys[IMPL_SOFTWARE] = dpy;
+ d->disp[IMPL_SOFTWARE].dpy = dpy;
if (dpy == EGL_NO_DISPLAY) {
loader.close(cnx->dso);
cnx->dso = NULL;
@@ -495,7 +582,7 @@
if (cnx->dso) {
EGLDisplay dpy = cnx->hooks->egl.eglGetDisplay(EGL_DEFAULT_DISPLAY);
LOGE_IF(dpy==EGL_NO_DISPLAY, "No EGLDisplay for hardware EGL!");
- d->dpys[IMPL_HARDWARE] = dpy;
+ d->disp[IMPL_HARDWARE].dpy = dpy;
if (dpy == EGL_NO_DISPLAY) {
loader.close(cnx->dso);
cnx->dso = NULL;
@@ -505,7 +592,7 @@
LOGD("3D hardware acceleration is disabled");
}
}
-
+
if (!gEGLImpl[IMPL_SOFTWARE].dso && !gEGLImpl[IMPL_HARDWARE].dso) {
return EGL_FALSE;
}
@@ -563,7 +650,6 @@
// initialize each EGL and
// build our own extension string first, based on the extension we know
// and the extension supported by our client implementation
- dp->extensionsString = strdup(gExtensionString);
for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) {
egl_connection_t* const cnx = &gEGLImpl[i];
cnx->major = -1;
@@ -571,25 +657,43 @@
if (!cnx->dso)
continue;
- if (cnx->hooks->egl.eglInitialize(
- dp->dpys[i], &cnx->major, &cnx->minor)) {
+#if defined(ADRENO130)
+#warning "Adreno-130 eglInitialize() workaround"
+ /*
+ * The ADRENO 130 driver returns a different EGLDisplay each time
+ * eglGetDisplay() is called, but also makes the EGLDisplay invalid
+ * after eglTerminate() has been called, so that eglInitialize()
+ * cannot be called again. Therefore, we need to make sure to call
+ * eglGetDisplay() before calling eglInitialize();
+ */
+ if (i == IMPL_HARDWARE) {
+ dp->disp[i].dpy =
+ cnx->hooks->egl.eglGetDisplay(EGL_DEFAULT_DISPLAY);
+ }
+#endif
+
+ EGLDisplay idpy = dp->disp[i].dpy;
+ if (cnx->hooks->egl.eglInitialize(idpy, &cnx->major, &cnx->minor)) {
//LOGD("initialized %d dpy=%p, ver=%d.%d, cnx=%p",
- // i, dp->dpys[i], cnx->major, cnx->minor, cnx);
+ // i, idpy, cnx->major, cnx->minor, cnx);
+
+ // display is now initialized
+ dp->disp[i].state = egl_display_t::INITIALIZED;
// get the query-strings for this display for each implementation
- dp->queryString[i].vendor =
- cnx->hooks->egl.eglQueryString(dp->dpys[i], EGL_VENDOR);
- dp->queryString[i].version =
- cnx->hooks->egl.eglQueryString(dp->dpys[i], EGL_VERSION);
- dp->queryString[i].extensions = strdup(
- cnx->hooks->egl.eglQueryString(dp->dpys[i], EGL_EXTENSIONS));
- dp->queryString[i].clientApi =
- cnx->hooks->egl.eglQueryString(dp->dpys[i], EGL_CLIENT_APIS);
+ dp->disp[i].queryString.vendor =
+ cnx->hooks->egl.eglQueryString(idpy, EGL_VENDOR);
+ dp->disp[i].queryString.version =
+ cnx->hooks->egl.eglQueryString(idpy, EGL_VERSION);
+ dp->disp[i].queryString.extensions =
+ cnx->hooks->egl.eglQueryString(idpy, EGL_EXTENSIONS);
+ dp->disp[i].queryString.clientApi =
+ cnx->hooks->egl.eglQueryString(idpy, EGL_CLIENT_APIS);
} else {
- LOGD("%d: eglInitialize() failed (%s)",
- i, egl_strerror(cnx->hooks->egl.eglGetError()));
+ LOGW("%d: eglInitialize(%p) failed (%s)", i, idpy,
+ egl_strerror(cnx->hooks->egl.eglGetError()));
}
}
@@ -598,15 +702,16 @@
egl_connection_t* const cnx = &gEGLImpl[i];
if (cnx->dso && cnx->major>=0 && cnx->minor>=0) {
EGLint n;
- if (cnx->hooks->egl.eglGetConfigs(dp->dpys[i], 0, 0, &n)) {
- dp->configs[i] = (EGLConfig*)malloc(sizeof(EGLConfig)*n);
- if (dp->configs[i]) {
+ if (cnx->hooks->egl.eglGetConfigs(dp->disp[i].dpy, 0, 0, &n)) {
+ dp->disp[i].config = (EGLConfig*)malloc(sizeof(EGLConfig)*n);
+ if (dp->disp[i].config) {
if (cnx->hooks->egl.eglGetConfigs(
- dp->dpys[i], dp->configs[i], n, &dp->numConfigs[i]))
+ dp->disp[i].dpy, dp->disp[i].config, n,
+ &dp->disp[i].numConfigs))
{
// sort the configurations so we can do binary searches
- qsort( dp->configs[i],
- dp->numConfigs[i],
+ qsort( dp->disp[i].config,
+ dp->disp[i].numConfigs,
sizeof(EGLConfig), cmp_configs);
dp->numTotalConfigs += n;
@@ -639,18 +744,24 @@
EGLBoolean res = EGL_FALSE;
for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) {
egl_connection_t* const cnx = &gEGLImpl[i];
- if (cnx->dso) {
- cnx->hooks->egl.eglTerminate(dp->dpys[i]);
+ if (cnx->dso && dp->disp[i].state == egl_display_t::INITIALIZED) {
+ if (cnx->hooks->egl.eglTerminate(dp->disp[i].dpy) == EGL_FALSE) {
+ LOGW("%d: eglTerminate(%p) failed (%s)", i, dp->disp[i].dpy,
+ egl_strerror(cnx->hooks->egl.eglGetError()));
+ }
// REVISIT: it's unclear what to do if eglTerminate() fails
- free(dp->configs[i]);
- free((void*)dp->queryString[i].extensions);
- dp->numConfigs[i] = 0;
- dp->dpys[i] = EGL_NO_DISPLAY;
+ free(dp->disp[i].config);
+
+ dp->disp[i].numConfigs = 0;
+ dp->disp[i].config = 0;
+ dp->disp[i].state = egl_display_t::TERMINATED;
+
res = EGL_TRUE;
}
}
- free((void*)dp->extensionsString);
- dp->extensionsString = 0;
+
+ // TODO: all egl_object_t should be marked for termination
+
dp->numTotalConfigs = 0;
clearTLS();
return res;
@@ -674,7 +785,7 @@
}
GLint n = 0;
for (int j=0 ; j<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; j++) {
- for (int i=0 ; i<dp->numConfigs[j] && config_size ; i++) {
+ for (int i=0 ; i<dp->disp[j].numConfigs && config_size ; i++) {
*configs++ = MAKE_CONFIG(j, i);
config_size--;
n++;
@@ -731,7 +842,7 @@
egl_connection_t* const cnx = &gEGLImpl[i];
if (cnx->dso) {
cnx->hooks->egl.eglGetConfigAttrib(
- dp->dpys[i], dp->configs[i][index],
+ dp->disp[i].dpy, dp->disp[i].config[index],
EGL_CONFIG_ID, &configId);
// and switch to the new list
@@ -746,7 +857,7 @@
// which one.
res = cnx->hooks->egl.eglChooseConfig(
- dp->dpys[i], attrib_list, configs, config_size, &n);
+ dp->disp[i].dpy, attrib_list, configs, config_size, &n);
if (res && n>0) {
// n has to be 0 or 1, by construction, and we already know
// which config it will return (since there can be only one).
@@ -765,13 +876,14 @@
egl_connection_t* const cnx = &gEGLImpl[i];
if (cnx->dso) {
if (cnx->hooks->egl.eglChooseConfig(
- dp->dpys[i], attrib_list, configs, config_size, &n)) {
+ dp->disp[i].dpy, attrib_list, configs, config_size, &n)) {
if (configs) {
// now we need to convert these client EGLConfig to our
// internal EGLConfig format. This is done in O(n log n).
for (int j=0 ; j<n ; j++) {
int index = binarySearch<EGLConfig>(
- dp->configs[i], 0, dp->numConfigs[i]-1, configs[j]);
+ dp->disp[i].config, 0,
+ dp->disp[i].numConfigs-1, configs[j]);
if (index >= 0) {
if (configs) {
configs[j] = MAKE_CONFIG(i, index);
@@ -806,7 +918,7 @@
return EGL_TRUE;
}
return cnx->hooks->egl.eglGetConfigAttrib(
- dp->dpys[i], dp->configs[i][index], attribute, value);
+ dp->disp[i].dpy, dp->disp[i].config[index], attribute, value);
}
// ----------------------------------------------------------------------------
@@ -822,7 +934,7 @@
egl_connection_t* cnx = validate_display_config(dpy, config, dp, i, index);
if (cnx) {
EGLSurface surface = cnx->hooks->egl.eglCreateWindowSurface(
- dp->dpys[i], dp->configs[i][index], window, attrib_list);
+ dp->disp[i].dpy, dp->disp[i].config[index], window, attrib_list);
if (surface != EGL_NO_SURFACE) {
egl_surface_t* s = new egl_surface_t(dpy, surface, i, cnx);
return s;
@@ -840,7 +952,7 @@
egl_connection_t* cnx = validate_display_config(dpy, config, dp, i, index);
if (cnx) {
EGLSurface surface = cnx->hooks->egl.eglCreatePixmapSurface(
- dp->dpys[i], dp->configs[i][index], pixmap, attrib_list);
+ dp->disp[i].dpy, dp->disp[i].config[index], pixmap, attrib_list);
if (surface != EGL_NO_SURFACE) {
egl_surface_t* s = new egl_surface_t(dpy, surface, i, cnx);
return s;
@@ -857,7 +969,7 @@
egl_connection_t* cnx = validate_display_config(dpy, config, dp, i, index);
if (cnx) {
EGLSurface surface = cnx->hooks->egl.eglCreatePbufferSurface(
- dp->dpys[i], dp->configs[i][index], attrib_list);
+ dp->disp[i].dpy, dp->disp[i].config[index], attrib_list);
if (surface != EGL_NO_SURFACE) {
egl_surface_t* s = new egl_surface_t(dpy, surface, i, cnx);
return s;
@@ -868,28 +980,35 @@
EGLBoolean eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
{
+ SurfaceRef _s(surface);
+ if (!_s.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE);
+
if (!validate_display_surface(dpy, surface))
return EGL_FALSE;
egl_display_t const * const dp = get_display(dpy);
- egl_surface_t const * const s = get_surface(surface);
+ egl_surface_t * const s = get_surface(surface);
EGLBoolean result = s->cnx->hooks->egl.eglDestroySurface(
- dp->dpys[s->impl], s->surface);
-
- delete s;
+ dp->disp[s->impl].dpy, s->surface);
+ if (result == EGL_TRUE) {
+ _s.terminate();
+ }
return result;
}
EGLBoolean eglQuerySurface( EGLDisplay dpy, EGLSurface surface,
EGLint attribute, EGLint *value)
{
+ SurfaceRef _s(surface);
+ if (!_s.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE);
+
if (!validate_display_surface(dpy, surface))
return EGL_FALSE;
egl_display_t const * const dp = get_display(dpy);
egl_surface_t const * const s = get_surface(surface);
return s->cnx->hooks->egl.eglQuerySurface(
- dp->dpys[s->impl], s->surface, attribute, value);
+ dp->disp[s->impl].dpy, s->surface, attribute, value);
}
// ----------------------------------------------------------------------------
@@ -904,7 +1023,8 @@
egl_connection_t* cnx = validate_display_config(dpy, config, dp, i, index);
if (cnx) {
EGLContext context = cnx->hooks->egl.eglCreateContext(
- dp->dpys[i], dp->configs[i][index], share_list, attrib_list);
+ dp->disp[i].dpy, dp->disp[i].config[index],
+ share_list, attrib_list);
if (context != EGL_NO_CONTEXT) {
egl_context_t* c = new egl_context_t(dpy, context, i, cnx);
return c;
@@ -915,66 +1035,125 @@
EGLBoolean eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
{
+ ContextRef _c(ctx);
+ if (!_c.get()) return setError(EGL_BAD_CONTEXT, EGL_FALSE);
+
if (!validate_display_context(dpy, ctx))
return EGL_FALSE;
egl_display_t const * const dp = get_display(dpy);
egl_context_t * const c = get_context(ctx);
EGLBoolean result = c->cnx->hooks->egl.eglDestroyContext(
- dp->dpys[c->impl], c->context);
- delete c;
+ dp->disp[c->impl].dpy, c->context);
+ if (result == EGL_TRUE) {
+ _c.terminate();
+ }
return result;
}
EGLBoolean eglMakeCurrent( EGLDisplay dpy, EGLSurface draw,
EGLSurface read, EGLContext ctx)
{
+ // get a reference to the object passed in
+ ContextRef _c(ctx);
+ SurfaceRef _d(draw);
+ SurfaceRef _r(read);
+
+ // validate the display and the context (if not EGL_NO_CONTEXT)
egl_display_t const * const dp = get_display(dpy);
if (!dp) return setError(EGL_BAD_DISPLAY, EGL_FALSE);
-
- if (read == EGL_NO_SURFACE && draw == EGL_NO_SURFACE &&
- ctx == EGL_NO_CONTEXT)
- {
- EGLBoolean result = EGL_TRUE;
- ctx = getContext();
- if (ctx) {
- egl_context_t * const c = get_context(ctx);
- result = c->cnx->hooks->egl.eglMakeCurrent(dp->dpys[c->impl], 0, 0, 0);
- if (result == EGL_TRUE) {
- setGlThreadSpecific(&gHooks[IMPL_NO_CONTEXT]);
- setContext(EGL_NO_CONTEXT);
- }
- }
- return result;
+ if ((ctx != EGL_NO_CONTEXT) && (!validate_display_context(dpy, ctx))) {
+ // EGL_NO_CONTEXT is valid
+ return EGL_FALSE;
}
- if (!validate_display_context(dpy, ctx))
- return EGL_FALSE;
-
+ // these are the underlying implementation's object
+ EGLContext impl_ctx = EGL_NO_CONTEXT;
EGLSurface impl_draw = EGL_NO_SURFACE;
EGLSurface impl_read = EGL_NO_SURFACE;
- egl_context_t * const c = get_context(ctx);
+
+ // these are our objects structs passed in
+ egl_context_t * c = NULL;
+ egl_surface_t const * d = NULL;
+ egl_surface_t const * r = NULL;
+
+ // these are the current objects structs
+ egl_context_t * cur_c = get_context(getContext());
+ egl_surface_t * cur_r = NULL;
+ egl_surface_t * cur_d = NULL;
+
+ if (ctx != EGL_NO_CONTEXT) {
+ c = get_context(ctx);
+ cur_r = get_surface(c->read);
+ cur_d = get_surface(c->draw);
+ impl_ctx = c->context;
+ } else {
+ // no context given, use the implementation of the current context
+ if (cur_c == NULL) {
+ // no current context
+ if (draw != EGL_NO_SURFACE || read != EGL_NO_SURFACE) {
+ // calling eglMakeCurrent( ..., EGL_NO_CONTEXT, !=0, !=0);
+ return setError(EGL_BAD_PARAMETER, EGL_FALSE);
+ }
+ // not an error, there is just not current context.
+ return EGL_TRUE;
+ }
+ }
+
+ // retrieve the underlying implementation's draw EGLSurface
if (draw != EGL_NO_SURFACE) {
- egl_surface_t const * d = get_surface(draw);
- if (!d) return setError(EGL_BAD_SURFACE, EGL_FALSE);
- if (d->impl != c->impl)
+ d = get_surface(draw);
+ // make sure the EGLContext and EGLSurface passed in are for
+ // the same driver
+ if (c && d->impl != c->impl)
return setError(EGL_BAD_MATCH, EGL_FALSE);
impl_draw = d->surface;
}
+
+ // retrieve the underlying implementation's read EGLSurface
if (read != EGL_NO_SURFACE) {
- egl_surface_t const * r = get_surface(read);
- if (!r) return setError(EGL_BAD_SURFACE, EGL_FALSE);
- if (r->impl != c->impl)
+ r = get_surface(read);
+ // make sure the EGLContext and EGLSurface passed in are for
+ // the same driver
+ if (c && r->impl != c->impl)
return setError(EGL_BAD_MATCH, EGL_FALSE);
impl_read = r->surface;
}
- EGLBoolean result = c->cnx->hooks->egl.eglMakeCurrent(
- dp->dpys[c->impl], impl_draw, impl_read, c->context);
+
+ EGLBoolean result;
+
+ if (c) {
+ result = c->cnx->hooks->egl.eglMakeCurrent(
+ dp->disp[c->impl].dpy, impl_draw, impl_read, impl_ctx);
+ } else {
+ result = cur_c->cnx->hooks->egl.eglMakeCurrent(
+ dp->disp[cur_c->impl].dpy, impl_draw, impl_read, impl_ctx);
+ }
if (result == EGL_TRUE) {
- setGlThreadSpecific(c->cnx->hooks);
- setContext(ctx);
- c->read = read;
- c->draw = draw;
+ // by construction, these are either 0 or valid (possibly terminated)
+ // it should be impossible for these to be invalid
+ ContextRef _cur_c(cur_c);
+ SurfaceRef _cur_r(cur_r);
+ SurfaceRef _cur_d(cur_d);
+
+ // cur_c has to be valid here (but could be terminated)
+ if (ctx != EGL_NO_CONTEXT) {
+ setGlThreadSpecific(c->cnx->hooks);
+ setContext(ctx);
+ _c.acquire();
+ } else {
+ setGlThreadSpecific(&gHooks[IMPL_NO_CONTEXT]);
+ setContext(EGL_NO_CONTEXT);
+ }
+ _cur_c.release();
+
+ _r.acquire();
+ _cur_r.release();
+ if (c) c->read = read;
+
+ _d.acquire();
+ _cur_d.release();
+ if (c) c->draw = draw;
}
return result;
}
@@ -983,6 +1162,9 @@
EGLBoolean eglQueryContext( EGLDisplay dpy, EGLContext ctx,
EGLint attribute, EGLint *value)
{
+ ContextRef _c(ctx);
+ if (!_c.get()) return setError(EGL_BAD_CONTEXT, EGL_FALSE);
+
if (!validate_display_context(dpy, ctx))
return EGL_FALSE;
@@ -990,7 +1172,7 @@
egl_context_t * const c = get_context(ctx);
return c->cnx->hooks->egl.eglQueryContext(
- dp->dpys[c->impl], c->context, attribute, value);
+ dp->disp[c->impl].dpy, c->context, attribute, value);
}
EGLContext eglGetCurrentContext(void)
@@ -1158,22 +1340,28 @@
EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface draw)
{
+ SurfaceRef _s(draw);
+ if (!_s.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE);
+
if (!validate_display_surface(dpy, draw))
return EGL_FALSE;
egl_display_t const * const dp = get_display(dpy);
egl_surface_t const * const s = get_surface(draw);
- return s->cnx->hooks->egl.eglSwapBuffers(dp->dpys[s->impl], s->surface);
+ return s->cnx->hooks->egl.eglSwapBuffers(dp->disp[s->impl].dpy, s->surface);
}
EGLBoolean eglCopyBuffers( EGLDisplay dpy, EGLSurface surface,
NativePixmapType target)
{
+ SurfaceRef _s(surface);
+ if (!_s.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE);
+
if (!validate_display_surface(dpy, surface))
return EGL_FALSE;
egl_display_t const * const dp = get_display(dpy);
egl_surface_t const * const s = get_surface(surface);
return s->cnx->hooks->egl.eglCopyBuffers(
- dp->dpys[s->impl], s->surface, target);
+ dp->disp[s->impl].dpy, s->surface, target);
}
const char* eglQueryString(EGLDisplay dpy, EGLint name)
@@ -1200,13 +1388,16 @@
EGLBoolean eglSurfaceAttrib(
EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value)
{
+ SurfaceRef _s(surface);
+ if (!_s.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE);
+
if (!validate_display_surface(dpy, surface))
return EGL_FALSE;
egl_display_t const * const dp = get_display(dpy);
egl_surface_t const * const s = get_surface(surface);
if (s->cnx->hooks->egl.eglSurfaceAttrib) {
return s->cnx->hooks->egl.eglSurfaceAttrib(
- dp->dpys[s->impl], s->surface, attribute, value);
+ dp->disp[s->impl].dpy, s->surface, attribute, value);
}
return setError(EGL_BAD_SURFACE, EGL_FALSE);
}
@@ -1214,13 +1405,16 @@
EGLBoolean eglBindTexImage(
EGLDisplay dpy, EGLSurface surface, EGLint buffer)
{
+ SurfaceRef _s(surface);
+ if (!_s.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE);
+
if (!validate_display_surface(dpy, surface))
return EGL_FALSE;
egl_display_t const * const dp = get_display(dpy);
egl_surface_t const * const s = get_surface(surface);
if (s->cnx->hooks->egl.eglBindTexImage) {
return s->cnx->hooks->egl.eglBindTexImage(
- dp->dpys[s->impl], s->surface, buffer);
+ dp->disp[s->impl].dpy, s->surface, buffer);
}
return setError(EGL_BAD_SURFACE, EGL_FALSE);
}
@@ -1228,13 +1422,16 @@
EGLBoolean eglReleaseTexImage(
EGLDisplay dpy, EGLSurface surface, EGLint buffer)
{
+ SurfaceRef _s(surface);
+ if (!_s.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE);
+
if (!validate_display_surface(dpy, surface))
return EGL_FALSE;
egl_display_t const * const dp = get_display(dpy);
egl_surface_t const * const s = get_surface(surface);
if (s->cnx->hooks->egl.eglReleaseTexImage) {
return s->cnx->hooks->egl.eglReleaseTexImage(
- dp->dpys[s->impl], s->surface, buffer);
+ dp->disp[s->impl].dpy, s->surface, buffer);
}
return setError(EGL_BAD_SURFACE, EGL_FALSE);
}
@@ -1249,7 +1446,8 @@
egl_connection_t* const cnx = &gEGLImpl[i];
if (cnx->dso) {
if (cnx->hooks->egl.eglSwapInterval) {
- if (cnx->hooks->egl.eglSwapInterval(dp->dpys[i], interval) == EGL_FALSE) {
+ if (cnx->hooks->egl.eglSwapInterval(
+ dp->disp[i].dpy, interval) == EGL_FALSE) {
res = EGL_FALSE;
}
}
@@ -1351,7 +1549,8 @@
if (!cnx) return EGL_FALSE;
if (cnx->hooks->egl.eglCreatePbufferFromClientBuffer) {
return cnx->hooks->egl.eglCreatePbufferFromClientBuffer(
- dp->dpys[i], buftype, buffer, dp->configs[i][index], attrib_list);
+ dp->disp[i].dpy, buftype, buffer,
+ dp->disp[i].config[index], attrib_list);
}
return setError(EGL_BAD_CONFIG, EGL_NO_SURFACE);
}
@@ -1363,6 +1562,9 @@
EGLBoolean eglLockSurfaceKHR(EGLDisplay dpy, EGLSurface surface,
const EGLint *attrib_list)
{
+ SurfaceRef _s(surface);
+ if (!_s.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE);
+
if (!validate_display_surface(dpy, surface))
return EGL_FALSE;
@@ -1371,13 +1573,16 @@
if (s->cnx->hooks->egl.eglLockSurfaceKHR) {
return s->cnx->hooks->egl.eglLockSurfaceKHR(
- dp->dpys[s->impl], s->surface, attrib_list);
+ dp->disp[s->impl].dpy, s->surface, attrib_list);
}
return setError(EGL_BAD_DISPLAY, EGL_FALSE);
}
EGLBoolean eglUnlockSurfaceKHR(EGLDisplay dpy, EGLSurface surface)
{
+ SurfaceRef _s(surface);
+ if (!_s.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE);
+
if (!validate_display_surface(dpy, surface))
return EGL_FALSE;
@@ -1386,7 +1591,7 @@
if (s->cnx->hooks->egl.eglUnlockSurfaceKHR) {
return s->cnx->hooks->egl.eglUnlockSurfaceKHR(
- dp->dpys[s->impl], s->surface);
+ dp->disp[s->impl].dpy, s->surface);
}
return setError(EGL_BAD_DISPLAY, EGL_FALSE);
}
@@ -1395,13 +1600,15 @@
EGLClientBuffer buffer, const EGLint *attrib_list)
{
if (ctx != EGL_NO_CONTEXT) {
+ ContextRef _c(ctx);
+ if (!_c.get()) return setError(EGL_BAD_CONTEXT, EGL_NO_IMAGE_KHR);
if (!validate_display_context(dpy, ctx))
return EGL_NO_IMAGE_KHR;
egl_display_t const * const dp = get_display(dpy);
egl_context_t * const c = get_context(ctx);
// since we have an EGLContext, we know which implementation to use
EGLImageKHR image = c->cnx->hooks->egl.eglCreateImageKHR(
- dp->dpys[c->impl], c->context, target, buffer, attrib_list);
+ dp->disp[c->impl].dpy, c->context, target, buffer, attrib_list);
if (image == EGL_NO_IMAGE_KHR)
return image;
@@ -1425,7 +1632,7 @@
if (cnx->dso) {
if (cnx->hooks->egl.eglCreateImageKHR) {
implImages[i] = cnx->hooks->egl.eglCreateImageKHR(
- dp->dpys[i], ctx, target, buffer, attrib_list);
+ dp->disp[i].dpy, ctx, target, buffer, attrib_list);
if (implImages[i] != EGL_NO_IMAGE_KHR) {
success = true;
}
@@ -1443,16 +1650,15 @@
EGLBoolean eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR img)
{
- egl_display_t const * const dp = get_display(dpy);
+ egl_display_t const * const dp = get_display(dpy);
if (dp == 0) {
return setError(EGL_BAD_DISPLAY, EGL_FALSE);
}
- egl_image_t* image = get_image(img);
- if (!image->isValid()) {
- return setError(EGL_BAD_PARAMETER, EGL_FALSE);
- }
+ ImageRef _i(img);
+ if (!_i.get()) return setError(EGL_BAD_PARAMETER, EGL_FALSE);
+ egl_image_t* image = get_image(img);
bool success = false;
for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) {
egl_connection_t* const cnx = &gEGLImpl[i];
@@ -1460,7 +1666,7 @@
if (cnx->dso) {
if (cnx->hooks->egl.eglCreateImageKHR) {
if (cnx->hooks->egl.eglDestroyImageKHR(
- dp->dpys[i], image->images[i])) {
+ dp->disp[i].dpy, image->images[i])) {
success = true;
}
}
@@ -1470,7 +1676,7 @@
if (!success)
return EGL_FALSE;
- delete image;
+ _i.terminate();
return EGL_TRUE;
}
@@ -1483,26 +1689,32 @@
EGLBoolean eglSetSwapRectangleANDROID(EGLDisplay dpy, EGLSurface draw,
EGLint left, EGLint top, EGLint width, EGLint height)
{
+ SurfaceRef _s(draw);
+ if (!_s.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE);
+
if (!validate_display_surface(dpy, draw))
return EGL_FALSE;
egl_display_t const * const dp = get_display(dpy);
egl_surface_t const * const s = get_surface(draw);
if (s->cnx->hooks->egl.eglSetSwapRectangleANDROID) {
- return s->cnx->hooks->egl.eglSetSwapRectangleANDROID(dp->dpys[s->impl],
- s->surface, left, top, width, height);
+ return s->cnx->hooks->egl.eglSetSwapRectangleANDROID(
+ dp->disp[s->impl].dpy, s->surface, left, top, width, height);
}
return setError(EGL_BAD_DISPLAY, NULL);
}
EGLClientBuffer eglGetRenderBufferANDROID(EGLDisplay dpy, EGLSurface draw)
{
+ SurfaceRef _s(draw);
+ if (!_s.get()) return setError(EGL_BAD_SURFACE, (EGLClientBuffer*)0);
+
if (!validate_display_surface(dpy, draw))
return 0;
egl_display_t const * const dp = get_display(dpy);
egl_surface_t const * const s = get_surface(draw);
if (s->cnx->hooks->egl.eglGetRenderBufferANDROID) {
- return s->cnx->hooks->egl.eglGetRenderBufferANDROID(dp->dpys[s->impl],
- s->surface);
+ return s->cnx->hooks->egl.eglGetRenderBufferANDROID(
+ dp->disp[s->impl].dpy, s->surface);
}
return setError(EGL_BAD_DISPLAY, (EGLClientBuffer*)0);
}
diff --git a/packages/SubscribedFeedsProvider/src/com/android/providers/subscribedfeeds/SubscribedFeedsProvider.java b/packages/SubscribedFeedsProvider/src/com/android/providers/subscribedfeeds/SubscribedFeedsProvider.java
index 120b4a3..2647752 100644
--- a/packages/SubscribedFeedsProvider/src/com/android/providers/subscribedfeeds/SubscribedFeedsProvider.java
+++ b/packages/SubscribedFeedsProvider/src/com/android/providers/subscribedfeeds/SubscribedFeedsProvider.java
@@ -127,7 +127,9 @@
protected void onAccountsChanged(Account[] accountsArray) {
super.onAccountsChanged(accountsArray);
for (Account account : accountsArray) {
- ContentResolver.setSyncAutomatically(account, "subscribedfeeds", true);
+ if (account.type.equals("com.google.GAIA")) {
+ ContentResolver.setSyncAutomatically(account, "subscribedfeeds", true);
+ }
}
}
diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java
index f8ba058..1384ede 100644
--- a/services/java/com/android/server/WindowManagerService.java
+++ b/services/java/com/android/server/WindowManagerService.java
@@ -8850,6 +8850,7 @@
"Now opening app" + wtoken);
wtoken.reportedVisible = false;
wtoken.inPendingTransaction = false;
+ wtoken.animation = null;
setTokenVisibilityLocked(wtoken, lp, true, transit, false);
wtoken.updateReportedVisibilityLocked();
wtoken.showAllWindowsLocked();
@@ -8860,6 +8861,7 @@
if (DEBUG_APP_TRANSITIONS) Log.v(TAG,
"Now closing app" + wtoken);
wtoken.inPendingTransaction = false;
+ wtoken.animation = null;
setTokenVisibilityLocked(wtoken, lp, false, transit, false);
wtoken.updateReportedVisibilityLocked();
// Force the allDrawn flag, because we want to start
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/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/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/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/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/test-runner/android/test/AndroidTestRunner.java b/test-runner/android/test/AndroidTestRunner.java
index 0d4e1e9..358b7e9 100644
--- a/test-runner/android/test/AndroidTestRunner.java
+++ b/test-runner/android/test/AndroidTestRunner.java
@@ -180,14 +180,23 @@
private void setInstrumentationIfInstrumentationTestCase(
Test test, Instrumentation instrumentation) {
if (InstrumentationTestCase.class.isAssignableFrom(test.getClass())) {
- ((InstrumentationTestCase) test).injectInsrumentation(instrumentation);
+ ((InstrumentationTestCase) test).injectInstrumentation(instrumentation);
}
}
- public void setInstrumentaiton(Instrumentation instrumentation) {
+ public void setInstrumentation(Instrumentation instrumentation) {
mInstrumentation = instrumentation;
}
+ /**
+ * @deprecated Incorrect spelling,
+ * use {@link #setInstrumentation(android.app.Instrumentation)} instead.
+ */
+ @Deprecated
+ public void setInstrumentaiton(Instrumentation instrumentation) {
+ setInstrumentation(instrumentation);
+ }
+
@Override
protected Class loadSuiteClass(String suiteClassName) throws ClassNotFoundException {
return mContext.getClassLoader().loadClass(suiteClassName);
diff --git a/test-runner/android/test/InstrumentationTestRunner.java b/test-runner/android/test/InstrumentationTestRunner.java
index 6658fb0..23f0ed4 100644
--- a/test-runner/android/test/InstrumentationTestRunner.java
+++ b/test-runner/android/test/InstrumentationTestRunner.java
@@ -329,7 +329,7 @@
mTestRunner = getAndroidTestRunner();
mTestRunner.setContext(getTargetContext());
- mTestRunner.setInstrumentaiton(this);
+ mTestRunner.setInstrumentation(this);
mTestRunner.setSkipExecution(logOnly);
mTestRunner.setTest(testSuiteBuilder.build());
mTestCount = mTestRunner.getTestCases().size();
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/tests/DumpRenderTree/src/com/android/dumprendertree/FileFilter.java b/tests/DumpRenderTree/src/com/android/dumprendertree/FileFilter.java
index ede5197..8fea967 100644
--- a/tests/DumpRenderTree/src/com/android/dumprendertree/FileFilter.java
+++ b/tests/DumpRenderTree/src/com/android/dumprendertree/FileFilter.java
@@ -79,7 +79,8 @@
"profiler", // profiler is not supported
"svg", // svg is not supported
"platform", // platform specific
- "http" // requires local http(s) server
+ "http", // requires local http(s) server
+ "fast/workers",
};
static final String [] ignoreTestList = {
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/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