summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java')
-rw-r--r--[-rwxr-xr-x]core/java/android/animation/ValueAnimator.java0
-rw-r--r--core/java/android/app/Activity.java10
-rw-r--r--core/java/android/app/ActivityManagerNative.java1
-rw-r--r--core/java/android/app/ActivityThread.java18
-rw-r--r--core/java/android/app/DownloadManager.java2
-rw-r--r--[-rwxr-xr-x]core/java/android/app/IAlarmManager.aidl0
-rw-r--r--[-rwxr-xr-x]core/java/android/app/IThumbnailReceiver.aidl0
-rw-r--r--core/java/android/app/LoaderManager.java1
-rw-r--r--core/java/android/app/PendingIntent.java4
-rw-r--r--[-rwxr-xr-x]core/java/android/app/admin/DevicePolicyManager.java0
-rw-r--r--[-rwxr-xr-x]core/java/android/appwidget/AppWidgetProvider.java0
-rw-r--r--[-rwxr-xr-x]core/java/android/bluetooth/BluetoothA2dp.java0
-rw-r--r--[-rwxr-xr-x]core/java/android/bluetooth/BluetoothAdapter.java0
-rw-r--r--[-rwxr-xr-x]core/java/android/bluetooth/BluetoothDevice.java0
-rw-r--r--[-rwxr-xr-x]core/java/android/bluetooth/BluetoothHeadset.java0
-rw-r--r--[-rwxr-xr-x]core/java/android/bluetooth/BluetoothInputDevice.java0
-rw-r--r--[-rwxr-xr-x]core/java/android/bluetooth/BluetoothPbap.java0
-rw-r--r--[-rwxr-xr-x]core/java/android/bluetooth/BluetoothProfile.java0
-rw-r--r--[-rwxr-xr-x]core/java/android/bluetooth/IBluetoothInputDevice.aidl0
-rw-r--r--[-rwxr-xr-x]core/java/android/bluetooth/IBluetoothManager.aidl0
-rw-r--r--core/java/android/content/ContentResolver.java10
-rw-r--r--[-rwxr-xr-x]core/java/android/content/IIntentReceiver.aidl0
-rw-r--r--core/java/android/content/Intent.java6
-rw-r--r--core/java/android/content/pm/ApplicationInfo.java15
-rw-r--r--[-rwxr-xr-x]core/java/android/content/res/Configuration.aidl0
-rw-r--r--[-rwxr-xr-x]core/java/android/content/res/ObbInfo.aidl0
-rw-r--r--[-rwxr-xr-x]core/java/android/content/res/Resources.java43
-rw-r--r--[-rwxr-xr-x]core/java/android/database/IContentObserver.aidl0
-rw-r--r--core/java/android/database/sqlite/SQLiteConnection.java9
-rw-r--r--core/java/android/database/sqlite/SQLiteDatabase.java9
-rw-r--r--core/java/android/database/sqlite/SQLiteSession.java2
-rw-r--r--[-rwxr-xr-x]core/java/android/ddm/package.html0
-rw-r--r--[-rwxr-xr-x]core/java/android/debug/package.html0
-rw-r--r--[-rwxr-xr-x]core/java/android/gesture/Gesture.java0
-rw-r--r--[-rwxr-xr-x]core/java/android/gesture/GestureOverlayView.java0
-rw-r--r--[-rwxr-xr-x]core/java/android/gesture/GestureUtils.java0
-rw-r--r--[-rwxr-xr-x]core/java/android/gesture/Instance.java0
-rw-r--r--[-rwxr-xr-x]core/java/android/gesture/Learner.java0
-rw-r--r--[-rwxr-xr-x]core/java/android/gesture/Prediction.java0
-rw-r--r--core/java/android/hardware/Camera.java2
-rw-r--r--core/java/android/hardware/SystemSensorManager.java3
-rw-r--r--[-rwxr-xr-x]core/java/android/hardware/input/InputManager.java0
-rw-r--r--core/java/android/net/SSLCertificateSocketFactory.java22
-rw-r--r--[-rwxr-xr-x]core/java/android/net/Uri.aidl0
-rw-r--r--core/java/android/net/http/AndroidHttpClient.java3
-rw-r--r--core/java/android/net/http/SslCertificate.java41
-rw-r--r--[-rwxr-xr-x]core/java/android/net/http/package.html0
-rw-r--r--[-rwxr-xr-x]core/java/android/net/package.html0
-rw-r--r--core/java/android/os/CommonTimeUtils.java20
-rw-r--r--core/java/android/os/Debug.java306
-rw-r--r--[-rwxr-xr-x]core/java/android/os/IHardwareService.aidl0
-rw-r--r--[-rwxr-xr-x]core/java/android/os/IVibratorService.aidl0
-rw-r--r--[-rwxr-xr-x]core/java/android/os/TokenWatcher.java0
-rw-r--r--[-rwxr-xr-x]core/java/android/provider/ContactsContract.java0
-rw-r--r--core/java/android/provider/MediaStore.java18
-rw-r--r--core/java/android/security/IKeystoreService.java542
-rw-r--r--[-rwxr-xr-x]core/java/android/server/package.html0
-rw-r--r--[-rwxr-xr-x]core/java/android/speech/tts/ITextToSpeechCallback.aidl0
-rw-r--r--[-rwxr-xr-x]core/java/android/speech/tts/TextToSpeech.java0
-rw-r--r--core/java/android/text/format/DateFormat.java395
-rw-r--r--core/java/android/text/format/DateUtils.java387
-rw-r--r--core/java/android/text/format/Formatter.java14
-rw-r--r--core/java/android/text/format/Time.java3
-rw-r--r--core/java/android/util/FloatMath.java10
-rw-r--r--core/java/android/util/Patterns.java8
-rwxr-xr-xcore/java/android/util/PropertyValueModel.java143
-rwxr-xr-xcore/java/android/util/ValueModel.java74
-rw-r--r--[-rwxr-xr-x]core/java/android/view/InputDevice.java0
-rw-r--r--[-rwxr-xr-x]core/java/android/view/InputEvent.java0
-rw-r--r--[-rwxr-xr-x]core/java/android/view/KeyEvent.java0
-rw-r--r--[-rwxr-xr-x]core/java/android/view/OrientationEventListener.java0
-rw-r--r--core/java/android/view/View.java3
-rw-r--r--core/java/android/view/ViewRootImpl.java6
-rw-r--r--core/java/android/view/ViewStub.java3
-rw-r--r--[-rwxr-xr-x]core/java/android/view/WindowManager.aidl0
-rw-r--r--[-rwxr-xr-x]core/java/android/view/WindowOrientationListener.java1
-rw-r--r--[-rwxr-xr-x]core/java/android/view/animation/package.html0
-rw-r--r--core/java/android/webkit/BrowserFrame.java15
-rw-r--r--core/java/android/webkit/ClientCertRequestHandler.java17
-rw-r--r--[-rwxr-xr-x]core/java/android/webkit/DeviceMotionService.java0
-rw-r--r--[-rwxr-xr-x]core/java/android/webkit/DeviceOrientationService.java0
-rw-r--r--core/java/android/webkit/FindActionModeCallback.java2
-rw-r--r--[-rwxr-xr-x]core/java/android/webkit/GeolocationPermissions.java0
-rw-r--r--[-rwxr-xr-x]core/java/android/webkit/GeolocationPermissionsClassic.java0
-rw-r--r--[-rwxr-xr-x]core/java/android/webkit/GeolocationService.java0
-rw-r--r--core/java/android/webkit/HTML5Audio.java29
-rw-r--r--core/java/android/webkit/WebCoreThreadWatchdog.java2
-rw-r--r--core/java/android/webkit/WebViewClassic.java138
-rw-r--r--core/java/android/webkit/WebViewCore.java2
-rw-r--r--core/java/android/widget/AbsListView.java3
-rw-r--r--[-rwxr-xr-x]core/java/android/widget/AppSecurityPermissions.java0
-rw-r--r--core/java/android/widget/CheckBox.java23
-rw-r--r--core/java/android/widget/DateTimeView.java10
-rw-r--r--core/java/android/widget/DigitalClock.java15
-rw-r--r--core/java/android/widget/EditText.java23
-rw-r--r--core/java/android/widget/Editor.java13
-rw-r--r--core/java/android/widget/HeaderViewListAdapter.java3
-rw-r--r--core/java/android/widget/ListView.java26
-rw-r--r--core/java/android/widget/NumberPicker.java4
-rw-r--r--core/java/android/widget/SeekBar.java20
-rw-r--r--core/java/android/widget/TextClock.java111
-rwxr-xr-xcore/java/android/widget/ValueEditor.java53
-rw-r--r--[-rwxr-xr-x]core/java/com/android/internal/app/IMediaContainerService.aidl0
-rw-r--r--[-rwxr-xr-x]core/java/com/android/internal/app/IUsageStats.aidl0
-rw-r--r--[-rwxr-xr-x]core/java/com/android/internal/app/NetInitiatedActivity.java0
-rw-r--r--core/java/com/android/internal/app/ResolverActivity.java68
-rw-r--r--core/java/com/android/internal/backup/LocalTransport.java5
-rw-r--r--[-rwxr-xr-x]core/java/com/android/internal/os/PkgUsageStats.aidl0
-rw-r--r--[-rwxr-xr-x]core/java/com/android/internal/os/PkgUsageStats.java0
-rw-r--r--core/java/com/android/internal/os/SamplingProfilerIntegration.java2
-rw-r--r--core/java/com/android/internal/util/AsyncChannel.java37
-rw-r--r--core/java/com/android/internal/view/menu/MenuItemImpl.java5
112 files changed, 1425 insertions, 1335 deletions
diff --git a/core/java/android/animation/ValueAnimator.java b/core/java/android/animation/ValueAnimator.java
index f7460c4..f7460c4 100755..100644
--- a/core/java/android/animation/ValueAnimator.java
+++ b/core/java/android/animation/ValueAnimator.java
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index e96b475..d6ddeb6 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -2539,12 +2539,16 @@ public class Activity extends ContextThemeWrapper
* Activity don't need to deal with feature codes.
*/
public boolean onMenuItemSelected(int featureId, MenuItem item) {
+ CharSequence titleCondensed = item.getTitleCondensed();
+
switch (featureId) {
case Window.FEATURE_OPTIONS_PANEL:
// Put event logging here so it gets called even if subclass
// doesn't call through to superclass's implmeentation of each
// of these methods below
- EventLog.writeEvent(50000, 0, item.getTitleCondensed());
+ if(titleCondensed != null) {
+ EventLog.writeEvent(50000, 0, titleCondensed.toString());
+ }
if (onOptionsItemSelected(item)) {
return true;
}
@@ -2562,7 +2566,9 @@ public class Activity extends ContextThemeWrapper
return false;
case Window.FEATURE_CONTEXT_MENU:
- EventLog.writeEvent(50000, 1, item.getTitleCondensed());
+ if(titleCondensed != null) {
+ EventLog.writeEvent(50000, 1, titleCondensed.toString());
+ }
if (onContextItemSelected(item)) {
return true;
}
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index 61b2067..fe7338b 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -1147,6 +1147,7 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
IActivityController watcher = IActivityController.Stub.asInterface(
data.readStrongBinder());
setActivityController(watcher);
+ reply.writeNoException();
return true;
}
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index d62372c..22fd9a9 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -113,6 +113,7 @@ import java.util.TimeZone;
import java.util.regex.Pattern;
import libcore.io.DropBox;
+import libcore.io.EventLogger;
import libcore.io.IoUtils;
import dalvik.system.CloseGuard;
@@ -4491,6 +4492,8 @@ public final class ActivityThread {
+ "snatched provider from the jaws of death");
}
prc.removePending = false;
+ // There is a race! It fails to remove the message, which
+ // will be handled in completeRemoveProvider().
mH.removeMessages(H.REMOVE_PROVIDER, prc);
} else {
unstableDelta = 0;
@@ -4670,6 +4673,11 @@ public final class ActivityThread {
return;
}
+ // More complicated race!! Some client managed to acquire the
+ // provider and release it before the removal was completed.
+ // Continue the removal, and abort the next remove message.
+ prc.removePending = false;
+
final IBinder jBinder = prc.holder.provider.asBinder();
ProviderRefCount existingPrc = mProviderRefCountMap.get(jBinder);
if (existingPrc == prc) {
@@ -4980,6 +4988,13 @@ public final class ActivityThread {
}
}
+ private static class EventLoggingReporter implements EventLogger.Reporter {
+ @Override
+ public void report (int code, Object... list) {
+ EventLog.writeEvent(code, list);
+ }
+ }
+
private class DropBoxReporter implements DropBox.Reporter {
private DropBoxManager dropBox;
@@ -5009,6 +5024,9 @@ public final class ActivityThread {
Environment.initForCurrentUser();
+ // Set the reporter for event logging in libcore
+ EventLogger.setReporter(new EventLoggingReporter());
+
Process.setArgV0("<pre-initialized>");
Looper.prepareMainLooper();
diff --git a/core/java/android/app/DownloadManager.java b/core/java/android/app/DownloadManager.java
index 6cf4dd0..32e40ee 100644
--- a/core/java/android/app/DownloadManager.java
+++ b/core/java/android/app/DownloadManager.java
@@ -499,7 +499,7 @@ public class DownloadManager {
" already exists and is not a directory");
}
} else {
- if (!file.mkdir()) {
+ if (!file.mkdirs()) {
throw new IllegalStateException("Unable to create directory: "+
file.getAbsolutePath());
}
diff --git a/core/java/android/app/IAlarmManager.aidl b/core/java/android/app/IAlarmManager.aidl
index edb40ed..edb40ed 100755..100644
--- a/core/java/android/app/IAlarmManager.aidl
+++ b/core/java/android/app/IAlarmManager.aidl
diff --git a/core/java/android/app/IThumbnailReceiver.aidl b/core/java/android/app/IThumbnailReceiver.aidl
index 7943f2c..7943f2c 100755..100644
--- a/core/java/android/app/IThumbnailReceiver.aidl
+++ b/core/java/android/app/IThumbnailReceiver.aidl
diff --git a/core/java/android/app/LoaderManager.java b/core/java/android/app/LoaderManager.java
index fd0f0bf..267555a 100644
--- a/core/java/android/app/LoaderManager.java
+++ b/core/java/android/app/LoaderManager.java
@@ -833,6 +833,7 @@ class LoaderManagerImpl extends LoaderManager {
for (int i = mLoaders.size()-1; i >= 0; i--) {
mLoaders.valueAt(i).destroy();
}
+ mLoaders.clear();
}
if (DEBUG) Log.v(TAG, "Destroying Inactive in " + this);
diff --git a/core/java/android/app/PendingIntent.java b/core/java/android/app/PendingIntent.java
index 5c75aff..2897ee0 100644
--- a/core/java/android/app/PendingIntent.java
+++ b/core/java/android/app/PendingIntent.java
@@ -289,7 +289,7 @@ public final class PendingIntent implements Parcelable {
/**
* Like {@link #getActivity(Context, int, Intent, int)}, but allows an
- * array of Intents to be supplied. The first Intent in the array is
+ * array of Intents to be supplied. The last Intent in the array is
* taken as the primary key for the PendingIntent, like the single Intent
* given to {@link #getActivity(Context, int, Intent, int)}. Upon sending
* the resulting PendingIntent, all of the Intents are started in the same
@@ -335,7 +335,7 @@ public final class PendingIntent implements Parcelable {
/**
* Like {@link #getActivity(Context, int, Intent, int)}, but allows an
- * array of Intents to be supplied. The first Intent in the array is
+ * array of Intents to be supplied. The last Intent in the array is
* taken as the primary key for the PendingIntent, like the single Intent
* given to {@link #getActivity(Context, int, Intent, int)}. Upon sending
* the resulting PendingIntent, all of the Intents are started in the same
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index 4c0eba0..4c0eba0 100755..100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
diff --git a/core/java/android/appwidget/AppWidgetProvider.java b/core/java/android/appwidget/AppWidgetProvider.java
index edf142b..edf142b 100755..100644
--- a/core/java/android/appwidget/AppWidgetProvider.java
+++ b/core/java/android/appwidget/AppWidgetProvider.java
diff --git a/core/java/android/bluetooth/BluetoothA2dp.java b/core/java/android/bluetooth/BluetoothA2dp.java
index 6fdf3b4..6fdf3b4 100755..100644
--- a/core/java/android/bluetooth/BluetoothA2dp.java
+++ b/core/java/android/bluetooth/BluetoothA2dp.java
diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java
index 6367e16..6367e16 100755..100644
--- a/core/java/android/bluetooth/BluetoothAdapter.java
+++ b/core/java/android/bluetooth/BluetoothAdapter.java
diff --git a/core/java/android/bluetooth/BluetoothDevice.java b/core/java/android/bluetooth/BluetoothDevice.java
index 4cc22b4..4cc22b4 100755..100644
--- a/core/java/android/bluetooth/BluetoothDevice.java
+++ b/core/java/android/bluetooth/BluetoothDevice.java
diff --git a/core/java/android/bluetooth/BluetoothHeadset.java b/core/java/android/bluetooth/BluetoothHeadset.java
index 793d798..793d798 100755..100644
--- a/core/java/android/bluetooth/BluetoothHeadset.java
+++ b/core/java/android/bluetooth/BluetoothHeadset.java
diff --git a/core/java/android/bluetooth/BluetoothInputDevice.java b/core/java/android/bluetooth/BluetoothInputDevice.java
index db7e424..db7e424 100755..100644
--- a/core/java/android/bluetooth/BluetoothInputDevice.java
+++ b/core/java/android/bluetooth/BluetoothInputDevice.java
diff --git a/core/java/android/bluetooth/BluetoothPbap.java b/core/java/android/bluetooth/BluetoothPbap.java
index b5280e5..b5280e5 100755..100644
--- a/core/java/android/bluetooth/BluetoothPbap.java
+++ b/core/java/android/bluetooth/BluetoothPbap.java
diff --git a/core/java/android/bluetooth/BluetoothProfile.java b/core/java/android/bluetooth/BluetoothProfile.java
index 1920efa..1920efa 100755..100644
--- a/core/java/android/bluetooth/BluetoothProfile.java
+++ b/core/java/android/bluetooth/BluetoothProfile.java
diff --git a/core/java/android/bluetooth/IBluetoothInputDevice.aidl b/core/java/android/bluetooth/IBluetoothInputDevice.aidl
index 1ebb9ca..1ebb9ca 100755..100644
--- a/core/java/android/bluetooth/IBluetoothInputDevice.aidl
+++ b/core/java/android/bluetooth/IBluetoothInputDevice.aidl
diff --git a/core/java/android/bluetooth/IBluetoothManager.aidl b/core/java/android/bluetooth/IBluetoothManager.aidl
index ed8777c..ed8777c 100755..100644
--- a/core/java/android/bluetooth/IBluetoothManager.aidl
+++ b/core/java/android/bluetooth/IBluetoothManager.aidl
diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java
index 9e406d4..bde4d2b 100644
--- a/core/java/android/content/ContentResolver.java
+++ b/core/java/android/content/ContentResolver.java
@@ -518,7 +518,7 @@ public abstract class ContentResolver {
* ContentProvider.openFile}.
* @return Returns a new ParcelFileDescriptor pointing to the file. You
* own this descriptor and are responsible for closing it when done.
- * @throws FileNotFoundException Throws FileNotFoundException of no
+ * @throws FileNotFoundException Throws FileNotFoundException if no
* file exists under the URI or the mode is invalid.
* @see #openAssetFileDescriptor(Uri, String)
*/
@@ -1049,9 +1049,9 @@ public abstract class ContentResolver {
if (!SCHEME_CONTENT.equals(uri.getScheme())) {
return null;
}
- String auth = uri.getAuthority();
+ final String auth = uri.getAuthority();
if (auth != null) {
- return acquireProvider(mContext, uri.getAuthority());
+ return acquireProvider(mContext, auth);
}
return null;
}
@@ -1068,9 +1068,9 @@ public abstract class ContentResolver {
if (!SCHEME_CONTENT.equals(uri.getScheme())) {
return null;
}
- String auth = uri.getAuthority();
+ final String auth = uri.getAuthority();
if (auth != null) {
- return acquireExistingProvider(mContext, uri.getAuthority());
+ return acquireExistingProvider(mContext, auth);
}
return null;
}
diff --git a/core/java/android/content/IIntentReceiver.aidl b/core/java/android/content/IIntentReceiver.aidl
index 3d92723..3d92723 100755..100644
--- a/core/java/android/content/IIntentReceiver.aidl
+++ b/core/java/android/content/IIntentReceiver.aidl
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index 72b0a8b..b7499c5 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -1950,7 +1950,7 @@ public class Intent implements Parcelable, Cloneable {
/**
* Broadcast Action: External media is present, but not mounted at its mount point.
- * The path to the mount point for the removed media is contained in the Intent.mData field.
+ * The path to the mount point for the unmounted media is contained in the Intent.mData field.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_MEDIA_UNMOUNTED = "android.intent.action.MEDIA_UNMOUNTED";
@@ -1971,7 +1971,7 @@ public class Intent implements Parcelable, Cloneable {
/**
* Broadcast Action: External media is present and mounted at its mount point.
- * The path to the mount point for the removed media is contained in the Intent.mData field.
+ * The path to the mount point for the mounted media is contained in the Intent.mData field.
* The Intent contains an extra with name "read-only" and Boolean value to indicate if the
* media was mounted read only.
*/
@@ -2002,7 +2002,7 @@ public class Intent implements Parcelable, Cloneable {
/**
* Broadcast Action: External media is present but cannot be mounted.
- * The path to the mount point for the removed media is contained in the Intent.mData field.
+ * The path to the mount point for the unmountable media is contained in the Intent.mData field.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_MEDIA_UNMOUNTABLE = "android.intent.action.MEDIA_UNMOUNTABLE";
diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java
index 32cc7fd..02401dc 100644
--- a/core/java/android/content/pm/ApplicationInfo.java
+++ b/core/java/android/content/pm/ApplicationInfo.java
@@ -398,6 +398,15 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
public String[] resourceDirs;
/**
+ * String retrieved from the seinfo tag found in selinux policy. This value
+ * is useful in setting an SELinux security context on the process as well
+ * as its data directory.
+ *
+ * {@hide}
+ */
+ public String seinfo;
+
+ /**
* Paths to all shared libraries this application is linked against. This
* field is only set if the {@link PackageManager#GET_SHARED_LIBRARY_FILES
* PackageManager.GET_SHARED_LIBRARY_FILES} flag was used when retrieving
@@ -477,6 +486,9 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
if (resourceDirs != null) {
pw.println(prefix + "resourceDirs=" + resourceDirs);
}
+ if (seinfo != null) {
+ pw.println(prefix + "seinfo=" + seinfo);
+ }
pw.println(prefix + "dataDir=" + dataDir);
if (sharedLibraryFiles != null) {
pw.println(prefix + "sharedLibraryFiles=" + sharedLibraryFiles);
@@ -544,6 +556,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
publicSourceDir = orig.publicSourceDir;
nativeLibraryDir = orig.nativeLibraryDir;
resourceDirs = orig.resourceDirs;
+ seinfo = orig.seinfo;
sharedLibraryFiles = orig.sharedLibraryFiles;
dataDir = orig.dataDir;
uid = orig.uid;
@@ -583,6 +596,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
dest.writeString(publicSourceDir);
dest.writeString(nativeLibraryDir);
dest.writeStringArray(resourceDirs);
+ dest.writeString(seinfo);
dest.writeStringArray(sharedLibraryFiles);
dest.writeString(dataDir);
dest.writeInt(uid);
@@ -621,6 +635,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
publicSourceDir = source.readString();
nativeLibraryDir = source.readString();
resourceDirs = source.readStringArray();
+ seinfo = source.readString();
sharedLibraryFiles = source.readStringArray();
dataDir = source.readString();
uid = source.readInt();
diff --git a/core/java/android/content/res/Configuration.aidl b/core/java/android/content/res/Configuration.aidl
index bb7f2dd..bb7f2dd 100755..100644
--- a/core/java/android/content/res/Configuration.aidl
+++ b/core/java/android/content/res/Configuration.aidl
diff --git a/core/java/android/content/res/ObbInfo.aidl b/core/java/android/content/res/ObbInfo.aidl
index 636ad6a..636ad6a 100755..100644
--- a/core/java/android/content/res/ObbInfo.aidl
+++ b/core/java/android/content/res/ObbInfo.aidl
diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java
index b316f23..0404a84 100755..100644
--- a/core/java/android/content/res/Resources.java
+++ b/core/java/android/content/res/Resources.java
@@ -232,11 +232,13 @@ public class Resources {
}
/**
- * Return the character sequence associated with a particular resource ID for a particular
- * numerical quantity.
- *
- * <p>See <a href="{@docRoot}guide/topics/resources/string-resource.html#Plurals">String
- * Resources</a> for more on quantity strings.
+ * Returns the character sequence necessary for grammatically correct pluralization
+ * of the given resource ID for the given quantity.
+ * Note that the character sequence is selected based solely on grammatical necessity,
+ * and that such rules differ between languages. Do not assume you know which string
+ * will be returned for a given quantity. See
+ * <a href="{@docRoot}guide/topics/resources/string-resource.html#Plurals">String Resources</a>
+ * for more detail.
*
* @param id The desired resource identifier, as generated by the aapt
* tool. This integer encodes the package, type, and resource
@@ -344,14 +346,17 @@ public class Resources {
}
/**
- * Return the string value associated with a particular resource ID for a particular
- * numerical quantity, substituting the format arguments as defined in
- * {@link java.util.Formatter} and {@link java.lang.String#format}. It will be
- * stripped of any styled text information.
- * {@more}
- *
- * <p>See <a href="{@docRoot}guide/topics/resources/string-resource.html#Plurals">String
- * Resources</a> for more on quantity strings.
+ * Formats the string necessary for grammatically correct pluralization
+ * of the given resource ID for the given quantity, using the given arguments.
+ * Note that the string is selected based solely on grammatical necessity,
+ * and that such rules differ between languages. Do not assume you know which string
+ * will be returned for a given quantity. See
+ * <a href="{@docRoot}guide/topics/resources/string-resource.html#Plurals">String Resources</a>
+ * for more detail.
+ *
+ * <p>Substitution of format arguments works as if using
+ * {@link java.util.Formatter} and {@link java.lang.String#format}.
+ * The resulting string will be stripped of any styled text information.
*
* @param id The desired resource identifier, as generated by the aapt
* tool. This integer encodes the package, type, and resource
@@ -372,11 +377,13 @@ public class Resources {
}
/**
- * Return the string value associated with a particular resource ID for a particular
- * numerical quantity.
- *
- * <p>See <a href="{@docRoot}guide/topics/resources/string-resource.html#Plurals">String
- * Resources</a> for more on quantity strings.
+ * Returns the string necessary for grammatically correct pluralization
+ * of the given resource ID for the given quantity.
+ * Note that the string is selected based solely on grammatical necessity,
+ * and that such rules differ between languages. Do not assume you know which string
+ * will be returned for a given quantity. See
+ * <a href="{@docRoot}guide/topics/resources/string-resource.html#Plurals">String Resources</a>
+ * for more detail.
*
* @param id The desired resource identifier, as generated by the aapt
* tool. This integer encodes the package, type, and resource
diff --git a/core/java/android/database/IContentObserver.aidl b/core/java/android/database/IContentObserver.aidl
index 13aff05..13aff05 100755..100644
--- a/core/java/android/database/IContentObserver.aidl
+++ b/core/java/android/database/IContentObserver.aidl
diff --git a/core/java/android/database/sqlite/SQLiteConnection.java b/core/java/android/database/sqlite/SQLiteConnection.java
index 6f7c1f3..0017c46 100644
--- a/core/java/android/database/sqlite/SQLiteConnection.java
+++ b/core/java/android/database/sqlite/SQLiteConnection.java
@@ -216,6 +216,13 @@ public final class SQLiteConnection implements CancellationSignal.OnCancelListen
setJournalSizeLimit();
setAutoCheckpointInterval();
setLocaleFromConfiguration();
+
+ // Register custom functions.
+ final int functionCount = mConfiguration.customFunctions.size();
+ for (int i = 0; i < functionCount; i++) {
+ SQLiteCustomFunction function = mConfiguration.customFunctions.get(i);
+ nativeRegisterCustomFunction(mConnectionPtr, function);
+ }
}
private void dispose(boolean finalized) {
@@ -974,7 +981,7 @@ public final class SQLiteConnection implements CancellationSignal.OnCancelListen
if (count != statement.mNumParameters) {
throw new SQLiteBindOrColumnIndexOutOfRangeException(
"Expected " + statement.mNumParameters + " bind arguments but "
- + bindArgs.length + " were provided.");
+ + count + " were provided.");
}
if (count == 0) {
return;
diff --git a/core/java/android/database/sqlite/SQLiteDatabase.java b/core/java/android/database/sqlite/SQLiteDatabase.java
index e2d44f2..60ccc61 100644
--- a/core/java/android/database/sqlite/SQLiteDatabase.java
+++ b/core/java/android/database/sqlite/SQLiteDatabase.java
@@ -1481,6 +1481,9 @@ public final class SQLiteDatabase extends SQLiteClosable {
* @param table the table to delete from
* @param whereClause the optional WHERE clause to apply when deleting.
* Passing null will delete all rows.
+ * @param whereArgs You may include ?s in the where clause, which
+ * will be replaced by the values from whereArgs. The values
+ * will be bound as Strings.
* @return the number of rows affected if a whereClause is passed in, 0
* otherwise. To remove all rows and get a count pass "1" as the
* whereClause.
@@ -1508,6 +1511,9 @@ public final class SQLiteDatabase extends SQLiteClosable {
* valid value that will be translated to NULL.
* @param whereClause the optional WHERE clause to apply when updating.
* Passing null will update all rows.
+ * @param whereArgs You may include ?s in the where clause, which
+ * will be replaced by the values from whereArgs. The values
+ * will be bound as Strings.
* @return the number of rows affected
*/
public int update(String table, ContentValues values, String whereClause, String[] whereArgs) {
@@ -1522,6 +1528,9 @@ public final class SQLiteDatabase extends SQLiteClosable {
* valid value that will be translated to NULL.
* @param whereClause the optional WHERE clause to apply when updating.
* Passing null will update all rows.
+ * @param whereArgs You may include ?s in the where clause, which
+ * will be replaced by the values from whereArgs. The values
+ * will be bound as Strings.
* @param conflictAlgorithm for update conflict resolver
* @return the number of rows affected
*/
diff --git a/core/java/android/database/sqlite/SQLiteSession.java b/core/java/android/database/sqlite/SQLiteSession.java
index beb5b3a..d80ab1f 100644
--- a/core/java/android/database/sqlite/SQLiteSession.java
+++ b/core/java/android/database/sqlite/SQLiteSession.java
@@ -926,7 +926,7 @@ public final class SQLiteSession {
}
private void throwIfNestedTransaction() {
- if (mTransactionStack == null && mTransactionStack.mParent != null) {
+ if (hasNestedTransaction()) {
throw new IllegalStateException("Cannot perform this operation because "
+ "a nested transaction is in progress.");
}
diff --git a/core/java/android/ddm/package.html b/core/java/android/ddm/package.html
index 1c9bf9d..1c9bf9d 100755..100644
--- a/core/java/android/ddm/package.html
+++ b/core/java/android/ddm/package.html
diff --git a/core/java/android/debug/package.html b/core/java/android/debug/package.html
index c9f96a6..c9f96a6 100755..100644
--- a/core/java/android/debug/package.html
+++ b/core/java/android/debug/package.html
diff --git a/core/java/android/gesture/Gesture.java b/core/java/android/gesture/Gesture.java
index c6a2a87..c6a2a87 100755..100644
--- a/core/java/android/gesture/Gesture.java
+++ b/core/java/android/gesture/Gesture.java
diff --git a/core/java/android/gesture/GestureOverlayView.java b/core/java/android/gesture/GestureOverlayView.java
index b6c260f..b6c260f 100755..100644
--- a/core/java/android/gesture/GestureOverlayView.java
+++ b/core/java/android/gesture/GestureOverlayView.java
diff --git a/core/java/android/gesture/GestureUtils.java b/core/java/android/gesture/GestureUtils.java
index dd221fc..dd221fc 100755..100644
--- a/core/java/android/gesture/GestureUtils.java
+++ b/core/java/android/gesture/GestureUtils.java
diff --git a/core/java/android/gesture/Instance.java b/core/java/android/gesture/Instance.java
index 02a6519..02a6519 100755..100644
--- a/core/java/android/gesture/Instance.java
+++ b/core/java/android/gesture/Instance.java
diff --git a/core/java/android/gesture/Learner.java b/core/java/android/gesture/Learner.java
index a105652..a105652 100755..100644
--- a/core/java/android/gesture/Learner.java
+++ b/core/java/android/gesture/Learner.java
diff --git a/core/java/android/gesture/Prediction.java b/core/java/android/gesture/Prediction.java
index ce6ad57..ce6ad57 100755..100644
--- a/core/java/android/gesture/Prediction.java
+++ b/core/java/android/gesture/Prediction.java
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
index a300776..483e9de 100644
--- a/core/java/android/hardware/Camera.java
+++ b/core/java/android/hardware/Camera.java
@@ -2338,7 +2338,7 @@ public class Camera {
}
/**
- * Sets the maximum and maximum preview fps. This controls the rate of
+ * Sets the minimum and maximum preview fps. This controls the rate of
* preview frames received in {@link PreviewCallback}. The minimum and
* maximum preview fps must be one of the elements from {@link
* #getSupportedPreviewFpsRange}.
diff --git a/core/java/android/hardware/SystemSensorManager.java b/core/java/android/hardware/SystemSensorManager.java
index 0204e94..7375e7d 100644
--- a/core/java/android/hardware/SystemSensorManager.java
+++ b/core/java/android/hardware/SystemSensorManager.java
@@ -373,7 +373,8 @@ public class SystemSensorManager extends SensorManager {
for (Sensor s : l.getSensors()) {
disableSensorLocked(s);
}
- } else if (l.removeSensor(sensor) == 0) {
+ // Check if the ListenerDelegate has the sensor it is trying to unregister.
+ } else if (l.hasSensor(sensor) && l.removeSensor(sensor) == 0) {
// if we have no more sensors enabled on this listener,
// take it off the list.
sListeners.remove(i);
diff --git a/core/java/android/hardware/input/InputManager.java b/core/java/android/hardware/input/InputManager.java
index 262d87d..262d87d 100755..100644
--- a/core/java/android/hardware/input/InputManager.java
+++ b/core/java/android/hardware/input/InputManager.java
diff --git a/core/java/android/net/SSLCertificateSocketFactory.java b/core/java/android/net/SSLCertificateSocketFactory.java
index 846443d..2a2f7cf 100644
--- a/core/java/android/net/SSLCertificateSocketFactory.java
+++ b/core/java/android/net/SSLCertificateSocketFactory.java
@@ -23,6 +23,7 @@ import java.net.InetAddress;
import java.net.Socket;
import java.net.SocketException;
import java.security.KeyManagementException;
+import java.security.PrivateKey;
import java.security.cert.X509Certificate;
import javax.net.SocketFactory;
import javax.net.ssl.HostnameVerifier;
@@ -88,6 +89,7 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory {
private TrustManager[] mTrustManagers = null;
private KeyManager[] mKeyManagers = null;
private byte[] mNpnProtocols = null;
+ private PrivateKey mChannelIdPrivateKey = null;
private final int mHandshakeTimeoutMillis;
private final SSLClientSessionCache mSessionCache;
@@ -319,6 +321,20 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory {
}
/**
+ * Sets the private key to be used for TLS Channel ID by connections made by this
+ * factory.
+ *
+ * @param privateKey private key (enables TLS Channel ID) or {@code null} for no key (disables
+ * TLS Channel ID). The private key has to be an Elliptic Curve (EC) key based on the
+ * NIST P-256 curve (aka SECG secp256r1 or ANSI X9.62 prime256v1).
+ *
+ * @hide
+ */
+ public void setChannelIdPrivateKey(PrivateKey privateKey) {
+ mChannelIdPrivateKey = privateKey;
+ }
+
+ /**
* Enables <a href="http://tools.ietf.org/html/rfc5077#section-3.2">session ticket</a>
* support on the given socket.
*
@@ -378,6 +394,7 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory {
OpenSSLSocketImpl s = (OpenSSLSocketImpl) getDelegate().createSocket(k, host, port, close);
s.setNpnProtocols(mNpnProtocols);
s.setHandshakeTimeout(mHandshakeTimeoutMillis);
+ s.setChannelIdPrivateKey(mChannelIdPrivateKey);
if (mSecure) {
verifyHostname(s, host);
}
@@ -397,6 +414,7 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory {
OpenSSLSocketImpl s = (OpenSSLSocketImpl) getDelegate().createSocket();
s.setNpnProtocols(mNpnProtocols);
s.setHandshakeTimeout(mHandshakeTimeoutMillis);
+ s.setChannelIdPrivateKey(mChannelIdPrivateKey);
return s;
}
@@ -414,6 +432,7 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory {
addr, port, localAddr, localPort);
s.setNpnProtocols(mNpnProtocols);
s.setHandshakeTimeout(mHandshakeTimeoutMillis);
+ s.setChannelIdPrivateKey(mChannelIdPrivateKey);
return s;
}
@@ -429,6 +448,7 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory {
OpenSSLSocketImpl s = (OpenSSLSocketImpl) getDelegate().createSocket(addr, port);
s.setNpnProtocols(mNpnProtocols);
s.setHandshakeTimeout(mHandshakeTimeoutMillis);
+ s.setChannelIdPrivateKey(mChannelIdPrivateKey);
return s;
}
@@ -445,6 +465,7 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory {
host, port, localAddr, localPort);
s.setNpnProtocols(mNpnProtocols);
s.setHandshakeTimeout(mHandshakeTimeoutMillis);
+ s.setChannelIdPrivateKey(mChannelIdPrivateKey);
if (mSecure) {
verifyHostname(s, host);
}
@@ -462,6 +483,7 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory {
OpenSSLSocketImpl s = (OpenSSLSocketImpl) getDelegate().createSocket(host, port);
s.setNpnProtocols(mNpnProtocols);
s.setHandshakeTimeout(mHandshakeTimeoutMillis);
+ s.setChannelIdPrivateKey(mChannelIdPrivateKey);
if (mSecure) {
verifyHostname(s, host);
}
diff --git a/core/java/android/net/Uri.aidl b/core/java/android/net/Uri.aidl
index 6bd3be5..6bd3be5 100755..100644
--- a/core/java/android/net/Uri.aidl
+++ b/core/java/android/net/Uri.aidl
diff --git a/core/java/android/net/http/AndroidHttpClient.java b/core/java/android/net/http/AndroidHttpClient.java
index c534e58..fabe018 100644
--- a/core/java/android/net/http/AndroidHttpClient.java
+++ b/core/java/android/net/http/AndroidHttpClient.java
@@ -66,8 +66,7 @@ import android.util.Log;
/**
* Implementation of the Apache {@link DefaultHttpClient} that is configured with
- * reasonable default settings and registered schemes for Android, and
- * also lets the user add {@link HttpRequestInterceptor} classes.
+ * reasonable default settings and registered schemes for Android.
* Don't create this directly, use the {@link #newInstance} factory method.
*
* <p>This client processes cookies but does not retain them by default.
diff --git a/core/java/android/net/http/SslCertificate.java b/core/java/android/net/http/SslCertificate.java
index fe6d4eb..5b60c0d 100644
--- a/core/java/android/net/http/SslCertificate.java
+++ b/core/java/android/net/http/SslCertificate.java
@@ -334,9 +334,11 @@ public class SslCertificate {
/**
* A distinguished name helper class: a 3-tuple of:
- * - common name (CN),
- * - organization (O),
- * - organizational unit (OU)
+ * <ul>
+ * <li>the most specific common name (CN)</li>
+ * <li>the most specific organization (O)</li>
+ * <li>the most specific organizational unit (OU)</li>
+ * <ul>
*/
public class DName {
/**
@@ -360,8 +362,15 @@ public class SslCertificate {
private String mUName;
/**
- * Creates a new distinguished name
- * @param dName The distinguished name
+ * Creates a new {@code DName} from a string. The attributes
+ * are assumed to come in most significant to least
+ * significant order which is true of human readable values
+ * returned by methods such as {@code X500Principal.getName()}.
+ * Be aware that the underlying sources of distinguished names
+ * such as instances of {@code X509Certificate} are encoded in
+ * least significant to most significant order, so make sure
+ * the value passed here has the expected ordering of
+ * attributes.
*/
public DName(String dName) {
if (dName != null) {
@@ -374,18 +383,24 @@ public class SslCertificate {
for (int i = 0; i < oid.size(); i++) {
if (oid.elementAt(i).equals(X509Name.CN)) {
- mCName = (String) val.elementAt(i);
+ if (mCName == null) {
+ mCName = (String) val.elementAt(i);
+ }
continue;
}
if (oid.elementAt(i).equals(X509Name.O)) {
- mOName = (String) val.elementAt(i);
- continue;
+ if (mOName == null) {
+ mOName = (String) val.elementAt(i);
+ continue;
+ }
}
if (oid.elementAt(i).equals(X509Name.OU)) {
- mUName = (String) val.elementAt(i);
- continue;
+ if (mUName == null) {
+ mUName = (String) val.elementAt(i);
+ continue;
+ }
}
}
} catch (IllegalArgumentException ex) {
@@ -402,21 +417,21 @@ public class SslCertificate {
}
/**
- * @return The Common-name (CN) component of this name
+ * @return The most specific Common-name (CN) component of this name
*/
public String getCName() {
return mCName != null ? mCName : "";
}
/**
- * @return The Organization (O) component of this name
+ * @return The most specific Organization (O) component of this name
*/
public String getOName() {
return mOName != null ? mOName : "";
}
/**
- * @return The Organizational Unit (OU) component of this name
+ * @return The most specific Organizational Unit (OU) component of this name
*/
public String getUName() {
return mUName != null ? mUName : "";
diff --git a/core/java/android/net/http/package.html b/core/java/android/net/http/package.html
index a81cbce..a81cbce 100755..100644
--- a/core/java/android/net/http/package.html
+++ b/core/java/android/net/http/package.html
diff --git a/core/java/android/net/package.html b/core/java/android/net/package.html
index 47c57e6..47c57e6 100755..100644
--- a/core/java/android/net/package.html
+++ b/core/java/android/net/package.html
diff --git a/core/java/android/os/CommonTimeUtils.java b/core/java/android/os/CommonTimeUtils.java
index 9081ee4..20755d9 100644
--- a/core/java/android/os/CommonTimeUtils.java
+++ b/core/java/android/os/CommonTimeUtils.java
@@ -19,6 +19,7 @@ import java.net.InetAddress;
import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetSocketAddress;
+import java.util.Locale;
import static libcore.io.OsConstants.*;
class CommonTimeUtils {
@@ -192,10 +193,11 @@ class CommonTimeUtils {
if (AF_INET == type) {
int addr = reply.readInt();
port = reply.readInt();
- addrStr = String.format("%d.%d.%d.%d", (addr >> 24) & 0xFF,
- (addr >> 16) & 0xFF,
- (addr >> 8) & 0xFF,
- addr & 0xFF);
+ addrStr = String.format(Locale.US, "%d.%d.%d.%d",
+ (addr >> 24) & 0xFF,
+ (addr >> 16) & 0xFF,
+ (addr >> 8) & 0xFF,
+ addr & 0xFF);
} else if (AF_INET6 == type) {
int addr1 = reply.readInt();
int addr2 = reply.readInt();
@@ -207,11 +209,11 @@ class CommonTimeUtils {
int flowinfo = reply.readInt();
int scope_id = reply.readInt();
- addrStr = String.format("[%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X]",
- (addr1 >> 16) & 0xFFFF, addr1 & 0xFFFF,
- (addr2 >> 16) & 0xFFFF, addr2 & 0xFFFF,
- (addr3 >> 16) & 0xFFFF, addr3 & 0xFFFF,
- (addr4 >> 16) & 0xFFFF, addr4 & 0xFFFF);
+ addrStr = String.format(Locale.US, "[%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X]",
+ (addr1 >> 16) & 0xFFFF, addr1 & 0xFFFF,
+ (addr2 >> 16) & 0xFFFF, addr2 & 0xFFFF,
+ (addr3 >> 16) & 0xFFFF, addr3 & 0xFFFF,
+ (addr4 >> 16) & 0xFFFF, addr4 & 0xFFFF);
}
if (null != addrStr) {
diff --git a/core/java/android/os/Debug.java b/core/java/android/os/Debug.java
index e50c948..2e77237 100644
--- a/core/java/android/os/Debug.java
+++ b/core/java/android/os/Debug.java
@@ -45,7 +45,7 @@ import dalvik.system.VMDebug;
/**
- * Provides various debugging functions for Android applications, including
+ * Provides various debugging methods for Android applications, including
* tracing and allocation counts.
* <p><strong>Logging Trace Files</strong></p>
* <p>Debug can create log files that give details about an application, such as
@@ -130,7 +130,7 @@ public final class Debug
public int otherSharedDirty;
/** @hide */
- public static final int NUM_OTHER_STATS = 9;
+ public static final int NUM_OTHER_STATS = 10;
private int[] otherStats = new int[NUM_OTHER_STATS*3];
@@ -177,15 +177,16 @@ public final class Debug
/* @hide */
public static String getOtherLabel(int which) {
switch (which) {
- case 0: return "Cursor";
- case 1: return "Ashmem";
- case 2: return "Other dev";
- case 3: return ".so mmap";
- case 4: return ".jar mmap";
- case 5: return ".apk mmap";
- case 6: return ".ttf mmap";
- case 7: return ".dex mmap";
- case 8: return "Other mmap";
+ case 0: return "Stack";
+ case 1: return "Cursor";
+ case 2: return "Ashmem";
+ case 3: return "Other dev";
+ case 4: return ".so mmap";
+ case 5: return ".jar mmap";
+ case 6: return ".apk mmap";
+ case 7: return ".ttf mmap";
+ case 8: return ".dex mmap";
+ case 9: return "Other mmap";
default: return "????";
}
}
@@ -554,16 +555,19 @@ href="{@docRoot}guide/developing/tools/traceview.html">Traceview: A Graphical Lo
/**
* Start counting the number and aggregate size of memory allocations.
*
- * <p>The {@link #startAllocCounting() start} function resets the counts and enables counting.
- * The {@link #stopAllocCounting() stop} function disables the counting so that the analysis
- * code doesn't cause additional allocations. The various <code>get</code> functions return
- * the specified value. And the various <code>reset</code> functions reset the specified
+ * <p>The {@link #startAllocCounting() start} method resets the counts and enables counting.
+ * The {@link #stopAllocCounting() stop} method disables the counting so that the analysis
+ * code doesn't cause additional allocations. The various <code>get</code> methods return
+ * the specified value. And the various <code>reset</code> methods reset the specified
* count.</p>
*
- * <p>Counts are kept for the system as a whole and for each thread.
+ * <p>Counts are kept for the system as a whole (global) and for each thread.
* The per-thread counts for threads other than the current thread
* are not cleared by the "reset" or "start" calls.</p>
+ *
+ * @deprecated Accurate counting is a burden on the runtime and may be removed.
*/
+ @Deprecated
public static void startAllocCounting() {
VMDebug.startAllocCounting();
}
@@ -577,211 +581,269 @@ href="{@docRoot}guide/developing/tools/traceview.html">Traceview: A Graphical Lo
VMDebug.stopAllocCounting();
}
+ /**
+ * Returns the global count of objects allocated by the runtime between a
+ * {@link #startAllocCounting() start} and {@link #stopAllocCounting() stop}.
+ */
public static int getGlobalAllocCount() {
return VMDebug.getAllocCount(VMDebug.KIND_GLOBAL_ALLOCATED_OBJECTS);
}
+
+ /**
+ * Clears the global count of objects allocated.
+ * @see #getGlobalAllocCount()
+ */
+ public static void resetGlobalAllocCount() {
+ VMDebug.resetAllocCount(VMDebug.KIND_GLOBAL_ALLOCATED_OBJECTS);
+ }
+
+ /**
+ * Returns the global size, in bytes, of objects allocated by the runtime between a
+ * {@link #startAllocCounting() start} and {@link #stopAllocCounting() stop}.
+ */
public static int getGlobalAllocSize() {
return VMDebug.getAllocCount(VMDebug.KIND_GLOBAL_ALLOCATED_BYTES);
}
+
+ /**
+ * Clears the global size of objects allocated.
+ * @see #getGlobalAllocCountSize()
+ */
+ public static void resetGlobalAllocSize() {
+ VMDebug.resetAllocCount(VMDebug.KIND_GLOBAL_ALLOCATED_BYTES);
+ }
+
+ /**
+ * Returns the global count of objects freed by the runtime between a
+ * {@link #startAllocCounting() start} and {@link #stopAllocCounting() stop}.
+ */
public static int getGlobalFreedCount() {
return VMDebug.getAllocCount(VMDebug.KIND_GLOBAL_FREED_OBJECTS);
}
+
+ /**
+ * Clears the global count of objects freed.
+ * @see #getGlobalFreedCount()
+ */
+ public static void resetGlobalFreedCount() {
+ VMDebug.resetAllocCount(VMDebug.KIND_GLOBAL_FREED_OBJECTS);
+ }
+
+ /**
+ * Returns the global size, in bytes, of objects freed by the runtime between a
+ * {@link #startAllocCounting() start} and {@link #stopAllocCounting() stop}.
+ */
public static int getGlobalFreedSize() {
return VMDebug.getAllocCount(VMDebug.KIND_GLOBAL_FREED_BYTES);
}
+
+ /**
+ * Clears the global size of objects freed.
+ * @see #getGlobalFreedSize()
+ */
+ public static void resetGlobalFreedSize() {
+ VMDebug.resetAllocCount(VMDebug.KIND_GLOBAL_FREED_BYTES);
+ }
+
+ /**
+ * Returns the number of non-concurrent GC invocations between a
+ * {@link #startAllocCounting() start} and {@link #stopAllocCounting() stop}.
+ */
+ public static int getGlobalGcInvocationCount() {
+ return VMDebug.getAllocCount(VMDebug.KIND_GLOBAL_GC_INVOCATIONS);
+ }
+
+ /**
+ * Clears the count of non-concurrent GC invocations.
+ * @see #getGlobalGcInvocationCount()
+ */
+ public static void resetGlobalGcInvocationCount() {
+ VMDebug.resetAllocCount(VMDebug.KIND_GLOBAL_GC_INVOCATIONS);
+ }
+
+ /**
+ * Returns the number of classes successfully initialized (ie those that executed without
+ * throwing an exception) between a {@link #startAllocCounting() start} and
+ * {@link #stopAllocCounting() stop}.
+ */
public static int getGlobalClassInitCount() {
- /* number of classes that have been successfully initialized */
return VMDebug.getAllocCount(VMDebug.KIND_GLOBAL_CLASS_INIT_COUNT);
}
+
+ /**
+ * Clears the count of classes initialized.
+ * @see #getGlobalClassInitCount()
+ */
+ public static void resetGlobalClassInitCount() {
+ VMDebug.resetAllocCount(VMDebug.KIND_GLOBAL_CLASS_INIT_COUNT);
+ }
+
+ /**
+ * Returns the time spent successfully initializing classes between a
+ * {@link #startAllocCounting() start} and {@link #stopAllocCounting() stop}.
+ */
public static int getGlobalClassInitTime() {
/* cumulative elapsed time for class initialization, in usec */
return VMDebug.getAllocCount(VMDebug.KIND_GLOBAL_CLASS_INIT_TIME);
}
/**
- * Returns the global count of external allocation requests. The
- * external allocation tracking feature was removed in Honeycomb.
- * This method exists for compatibility and always returns 0.
- *
- * @deprecated This method is now obsolete.
+ * Clears the count of time spent initializing classes.
+ * @see #getGlobalClassInitTime()
*/
- @Deprecated
- public static int getGlobalExternalAllocCount() {
- return 0;
+ public static void resetGlobalClassInitTime() {
+ VMDebug.resetAllocCount(VMDebug.KIND_GLOBAL_CLASS_INIT_TIME);
}
/**
- * Returns the global count of bytes externally allocated. The
- * external allocation tracking feature was removed in Honeycomb.
* This method exists for compatibility and always returns 0.
- *
* @deprecated This method is now obsolete.
*/
@Deprecated
- public static int getGlobalExternalAllocSize() {
+ public static int getGlobalExternalAllocCount() {
return 0;
}
/**
- * Returns the global count of freed external allocation requests.
- * The external allocation tracking feature was removed in
- * Honeycomb. This method exists for compatibility and always
- * returns 0.
- *
+ * This method exists for compatibility and has no effect.
* @deprecated This method is now obsolete.
*/
@Deprecated
- public static int getGlobalExternalFreedCount() {
- return 0;
- }
+ public static void resetGlobalExternalAllocSize() {}
/**
- * Returns the global count of freed bytes from external
- * allocation requests. The external allocation tracking feature
- * was removed in Honeycomb. This method exists for compatibility
- * and always returns 0.
- *
+ * This method exists for compatibility and has no effect.
* @deprecated This method is now obsolete.
*/
@Deprecated
- public static int getGlobalExternalFreedSize() {
- return 0;
- }
-
- public static int getGlobalGcInvocationCount() {
- return VMDebug.getAllocCount(VMDebug.KIND_GLOBAL_GC_INVOCATIONS);
- }
- public static int getThreadAllocCount() {
- return VMDebug.getAllocCount(VMDebug.KIND_THREAD_ALLOCATED_OBJECTS);
- }
- public static int getThreadAllocSize() {
- return VMDebug.getAllocCount(VMDebug.KIND_THREAD_ALLOCATED_BYTES);
- }
+ public static void resetGlobalExternalAllocCount() {}
/**
- * Returns the count of external allocation requests made by the
- * current thread. The external allocation tracking feature was
- * removed in Honeycomb. This method exists for compatibility and
- * always returns 0.
- *
+ * This method exists for compatibility and always returns 0.
* @deprecated This method is now obsolete.
*/
@Deprecated
- public static int getThreadExternalAllocCount() {
+ public static int getGlobalExternalAllocSize() {
return 0;
}
/**
- * Returns the global count of bytes externally allocated. The
- * external allocation tracking feature was removed in Honeycomb.
* This method exists for compatibility and always returns 0.
- *
* @deprecated This method is now obsolete.
*/
@Deprecated
- public static int getThreadExternalAllocSize() {
+ public static int getGlobalExternalFreedCount() {
return 0;
}
- public static int getThreadGcInvocationCount() {
- return VMDebug.getAllocCount(VMDebug.KIND_THREAD_GC_INVOCATIONS);
- }
-
- public static void resetGlobalAllocCount() {
- VMDebug.resetAllocCount(VMDebug.KIND_GLOBAL_ALLOCATED_OBJECTS);
- }
- public static void resetGlobalAllocSize() {
- VMDebug.resetAllocCount(VMDebug.KIND_GLOBAL_ALLOCATED_BYTES);
- }
- public static void resetGlobalFreedCount() {
- VMDebug.resetAllocCount(VMDebug.KIND_GLOBAL_FREED_OBJECTS);
- }
- public static void resetGlobalFreedSize() {
- VMDebug.resetAllocCount(VMDebug.KIND_GLOBAL_FREED_BYTES);
- }
- public static void resetGlobalClassInitCount() {
- VMDebug.resetAllocCount(VMDebug.KIND_GLOBAL_CLASS_INIT_COUNT);
- }
- public static void resetGlobalClassInitTime() {
- VMDebug.resetAllocCount(VMDebug.KIND_GLOBAL_CLASS_INIT_TIME);
- }
-
/**
- * Resets the global count of external allocation requests. The
- * external allocation tracking feature was removed in Honeycomb.
* This method exists for compatibility and has no effect.
- *
* @deprecated This method is now obsolete.
*/
@Deprecated
- public static void resetGlobalExternalAllocCount() {}
+ public static void resetGlobalExternalFreedCount() {}
/**
- * Resets the global count of bytes externally allocated. The
- * external allocation tracking feature was removed in Honeycomb.
* This method exists for compatibility and has no effect.
- *
* @deprecated This method is now obsolete.
*/
@Deprecated
- public static void resetGlobalExternalAllocSize() {}
+ public static int getGlobalExternalFreedSize() {
+ return 0;
+ }
/**
- * Resets the global count of freed external allocations. The
- * external allocation tracking feature was removed in Honeycomb.
* This method exists for compatibility and has no effect.
- *
* @deprecated This method is now obsolete.
*/
@Deprecated
- public static void resetGlobalExternalFreedCount() {}
+ public static void resetGlobalExternalFreedSize() {}
/**
- * Resets the global count counter of freed bytes from external
- * allocations. The external allocation tracking feature was
- * removed in Honeycomb. This method exists for compatibility and
- * has no effect.
- *
- * @deprecated This method is now obsolete.
+ * Returns the thread-local count of objects allocated by the runtime between a
+ * {@link #startAllocCounting() start} and {@link #stopAllocCounting() stop}.
*/
- @Deprecated
- public static void resetGlobalExternalFreedSize() {}
-
- public static void resetGlobalGcInvocationCount() {
- VMDebug.resetAllocCount(VMDebug.KIND_GLOBAL_GC_INVOCATIONS);
+ public static int getThreadAllocCount() {
+ return VMDebug.getAllocCount(VMDebug.KIND_THREAD_ALLOCATED_OBJECTS);
}
+
+ /**
+ * Clears the thread-local count of objects allocated.
+ * @see #getThreadAllocCount()
+ */
public static void resetThreadAllocCount() {
VMDebug.resetAllocCount(VMDebug.KIND_THREAD_ALLOCATED_OBJECTS);
}
+
+ /**
+ * Returns the thread-local size of objects allocated by the runtime between a
+ * {@link #startAllocCounting() start} and {@link #stopAllocCounting() stop}.
+ * @return The allocated size in bytes.
+ */
+ public static int getThreadAllocSize() {
+ return VMDebug.getAllocCount(VMDebug.KIND_THREAD_ALLOCATED_BYTES);
+ }
+
+ /**
+ * Clears the thread-local count of objects allocated.
+ * @see #getThreadAllocSize()
+ */
public static void resetThreadAllocSize() {
VMDebug.resetAllocCount(VMDebug.KIND_THREAD_ALLOCATED_BYTES);
}
/**
- * Resets the count of external allocation requests made by the
- * current thread. The external allocation tracking feature was
- * removed in Honeycomb. This method exists for compatibility and
- * has no effect.
- *
+ * This method exists for compatibility and has no effect.
+ * @deprecated This method is now obsolete.
+ */
+ @Deprecated
+ public static int getThreadExternalAllocCount() {
+ return 0;
+ }
+
+ /**
+ * This method exists for compatibility and has no effect.
* @deprecated This method is now obsolete.
*/
@Deprecated
public static void resetThreadExternalAllocCount() {}
/**
- * Resets the count of bytes externally allocated by the current
- * thread. The external allocation tracking feature was removed
- * in Honeycomb. This method exists for compatibility and has no
- * effect.
- *
+ * This method exists for compatibility and has no effect.
+ * @deprecated This method is now obsolete.
+ */
+ @Deprecated
+ public static int getThreadExternalAllocSize() {
+ return 0;
+ }
+
+ /**
+ * This method exists for compatibility and has no effect.
* @deprecated This method is now obsolete.
*/
@Deprecated
public static void resetThreadExternalAllocSize() {}
+ /**
+ * Returns the number of thread-local non-concurrent GC invocations between a
+ * {@link #startAllocCounting() start} and {@link #stopAllocCounting() stop}.
+ */
+ public static int getThreadGcInvocationCount() {
+ return VMDebug.getAllocCount(VMDebug.KIND_THREAD_GC_INVOCATIONS);
+ }
+
+ /**
+ * Clears the thread-local count of non-concurrent GC invocations.
+ * @see #getThreadGcInvocationCount()
+ */
public static void resetThreadGcInvocationCount() {
VMDebug.resetAllocCount(VMDebug.KIND_THREAD_GC_INVOCATIONS);
}
+
+ /**
+ * Clears all the global and thread-local memory allocation counters.
+ * @see #startAllocCounting()
+ */
public static void resetAllCounts() {
VMDebug.resetAllocCount(VMDebug.KIND_ALL_COUNTS);
}
@@ -1380,7 +1442,7 @@ href="{@docRoot}guide/developing/tools/traceview.html">Traceview: A Graphical Lo
}
/**
- * @return a String describing the immediate caller of the calling function.
+ * @return a String describing the immediate caller of the calling method.
* {@hide}
*/
public static String getCaller() {
diff --git a/core/java/android/os/IHardwareService.aidl b/core/java/android/os/IHardwareService.aidl
index 38abfc0..38abfc0 100755..100644
--- a/core/java/android/os/IHardwareService.aidl
+++ b/core/java/android/os/IHardwareService.aidl
diff --git a/core/java/android/os/IVibratorService.aidl b/core/java/android/os/IVibratorService.aidl
index 2c2fe8a..2c2fe8a 100755..100644
--- a/core/java/android/os/IVibratorService.aidl
+++ b/core/java/android/os/IVibratorService.aidl
diff --git a/core/java/android/os/TokenWatcher.java b/core/java/android/os/TokenWatcher.java
index 9b3a2d6..9b3a2d6 100755..100644
--- a/core/java/android/os/TokenWatcher.java
+++ b/core/java/android/os/TokenWatcher.java
diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java
index e3053be..e3053be 100755..100644
--- a/core/java/android/provider/ContactsContract.java
+++ b/core/java/android/provider/ContactsContract.java
diff --git a/core/java/android/provider/MediaStore.java b/core/java/android/provider/MediaStore.java
index 0e7ab52..cb6300f 100644
--- a/core/java/android/provider/MediaStore.java
+++ b/core/java/android/provider/MediaStore.java
@@ -1324,6 +1324,18 @@ public final class MediaStore {
}
public static final class Media implements AudioColumns {
+
+ private static final String[] EXTERNAL_PATHS;
+
+ static {
+ String secondary_storage = System.getenv("SECONDARY_STORAGE");
+ if (secondary_storage != null) {
+ EXTERNAL_PATHS = secondary_storage.split(":");
+ } else {
+ EXTERNAL_PATHS = new String[0];
+ }
+ }
+
/**
* Get the content:// style URI for the audio media table on the
* given volume.
@@ -1337,6 +1349,12 @@ public final class MediaStore {
}
public static Uri getContentUriForPath(String path) {
+ for (String ep : EXTERNAL_PATHS) {
+ if (path.startsWith(ep)) {
+ return EXTERNAL_CONTENT_URI;
+ }
+ }
+
return (path.startsWith(Environment.getExternalStorageDirectory().getPath()) ?
EXTERNAL_CONTENT_URI : INTERNAL_CONTENT_URI);
}
diff --git a/core/java/android/security/IKeystoreService.java b/core/java/android/security/IKeystoreService.java
new file mode 100644
index 0000000..a890d9b
--- /dev/null
+++ b/core/java/android/security/IKeystoreService.java
@@ -0,0 +1,542 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.security;
+
+import android.os.Binder;
+import android.os.IBinder;
+import android.os.IInterface;
+import android.os.Parcel;
+import android.os.RemoteException;
+
+/**
+ * This must be kept manually in sync with system/security/keystore until AIDL
+ * can generate both Java and C++ bindings.
+ *
+ * @hide
+ */
+public interface IKeystoreService extends IInterface {
+ public static abstract class Stub extends Binder implements IKeystoreService {
+ private static class Proxy implements IKeystoreService {
+ private final IBinder mRemote;
+
+ Proxy(IBinder remote) {
+ mRemote = remote;
+ }
+
+ public IBinder asBinder() {
+ return mRemote;
+ }
+
+ public String getInterfaceDescriptor() {
+ return DESCRIPTOR;
+ }
+
+ public int test() throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ int _result;
+ try {
+ _data.writeInterfaceToken(DESCRIPTOR);
+ mRemote.transact(Stub.TRANSACTION_test, _data, _reply, 0);
+ _reply.readException();
+ _result = _reply.readInt();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ return _result;
+ }
+
+ public byte[] get(String name) throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ byte[] _result;
+ try {
+ _data.writeInterfaceToken(DESCRIPTOR);
+ _data.writeString(name);
+ mRemote.transact(Stub.TRANSACTION_get, _data, _reply, 0);
+ _reply.readException();
+ _result = _reply.createByteArray();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ return _result;
+ }
+
+ public int insert(String name, byte[] item, int uid) throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ int _result;
+ try {
+ _data.writeInterfaceToken(DESCRIPTOR);
+ _data.writeString(name);
+ _data.writeByteArray(item);
+ _data.writeInt(uid);
+ mRemote.transact(Stub.TRANSACTION_insert, _data, _reply, 0);
+ _reply.readException();
+ _result = _reply.readInt();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ return _result;
+ }
+
+ public int del(String name, int uid) throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ int _result;
+ try {
+ _data.writeInterfaceToken(DESCRIPTOR);
+ _data.writeString(name);
+ _data.writeInt(uid);
+ mRemote.transact(Stub.TRANSACTION_del, _data, _reply, 0);
+ _reply.readException();
+ _result = _reply.readInt();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ return _result;
+ }
+
+ public int exist(String name, int uid) throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ int _result;
+ try {
+ _data.writeInterfaceToken(DESCRIPTOR);
+ _data.writeString(name);
+ _data.writeInt(uid);
+ mRemote.transact(Stub.TRANSACTION_exist, _data, _reply, 0);
+ _reply.readException();
+ _result = _reply.readInt();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ return _result;
+ }
+
+ public String[] saw(String name, int uid) throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ String[] _result;
+ try {
+ _data.writeInterfaceToken(DESCRIPTOR);
+ _data.writeString(name);
+ _data.writeInt(uid);
+ mRemote.transact(Stub.TRANSACTION_saw, _data, _reply, 0);
+ _reply.readException();
+ int size = _reply.readInt();
+ _result = new String[size];
+ for (int i = 0; i < size; i++) {
+ _result[i] = _reply.readString();
+ }
+ int _ret = _reply.readInt();
+ if (_ret != 1) {
+ return null;
+ }
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ return _result;
+ }
+
+ @Override
+ public int reset() throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ int _result;
+ try {
+ _data.writeInterfaceToken(DESCRIPTOR);
+ mRemote.transact(Stub.TRANSACTION_reset, _data, _reply, 0);
+ _reply.readException();
+ _result = _reply.readInt();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ return _result;
+ }
+
+ public int password(String password) throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ int _result;
+ try {
+ _data.writeInterfaceToken(DESCRIPTOR);
+ _data.writeString(password);
+ mRemote.transact(Stub.TRANSACTION_password, _data, _reply, 0);
+ _reply.readException();
+ _result = _reply.readInt();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ return _result;
+ }
+
+ public int lock() throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ int _result;
+ try {
+ _data.writeInterfaceToken(DESCRIPTOR);
+ mRemote.transact(Stub.TRANSACTION_lock, _data, _reply, 0);
+ _reply.readException();
+ _result = _reply.readInt();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ return _result;
+ }
+
+ public int unlock(String password) throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ int _result;
+ try {
+ _data.writeInterfaceToken(DESCRIPTOR);
+ _data.writeString(password);
+ mRemote.transact(Stub.TRANSACTION_unlock, _data, _reply, 0);
+ _reply.readException();
+ _result = _reply.readInt();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ return _result;
+ }
+
+ @Override
+ public int zero() throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ int _result;
+ try {
+ _data.writeInterfaceToken(DESCRIPTOR);
+ mRemote.transact(Stub.TRANSACTION_zero, _data, _reply, 0);
+ _reply.readException();
+ _result = _reply.readInt();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ return _result;
+ }
+
+ public int generate(String name, int uid) throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ int _result;
+ try {
+ _data.writeInterfaceToken(DESCRIPTOR);
+ _data.writeString(name);
+ _data.writeInt(uid);
+ mRemote.transact(Stub.TRANSACTION_generate, _data, _reply, 0);
+ _reply.readException();
+ _result = _reply.readInt();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ return _result;
+ }
+
+ public int import_key(String name, byte[] data, int uid) throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ int _result;
+ try {
+ _data.writeInterfaceToken(DESCRIPTOR);
+ _data.writeString(name);
+ _data.writeByteArray(data);
+ _data.writeInt(uid);
+ mRemote.transact(Stub.TRANSACTION_import, _data, _reply, 0);
+ _reply.readException();
+ _result = _reply.readInt();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ return _result;
+ }
+
+ public byte[] sign(String name, byte[] data) throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ byte[] _result;
+ try {
+ _data.writeInterfaceToken(DESCRIPTOR);
+ _data.writeString(name);
+ _data.writeByteArray(data);
+ mRemote.transact(Stub.TRANSACTION_sign, _data, _reply, 0);
+ _reply.readException();
+ _result = _reply.createByteArray();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ return _result;
+ }
+
+ public int verify(String name, byte[] data, byte[] signature) throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ int _result;
+ try {
+ _data.writeInterfaceToken(DESCRIPTOR);
+ _data.writeString(name);
+ _data.writeByteArray(data);
+ _data.writeByteArray(signature);
+ mRemote.transact(Stub.TRANSACTION_verify, _data, _reply, 0);
+ _reply.readException();
+ _result = _reply.readInt();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ return _result;
+ }
+
+ public byte[] get_pubkey(String name) throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ byte[] _result;
+ try {
+ _data.writeInterfaceToken(DESCRIPTOR);
+ _data.writeString(name);
+ mRemote.transact(Stub.TRANSACTION_get_pubkey, _data, _reply, 0);
+ _reply.readException();
+ _result = _reply.createByteArray();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ return _result;
+ }
+
+ public int del_key(String name, int uid) throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ int _result;
+ try {
+ _data.writeInterfaceToken(DESCRIPTOR);
+ _data.writeString(name);
+ _data.writeInt(uid);
+ mRemote.transact(Stub.TRANSACTION_del_key, _data, _reply, 0);
+ _reply.readException();
+ _result = _reply.readInt();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ return _result;
+ }
+
+ public int grant(String name, int granteeUid) throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ int _result;
+ try {
+ _data.writeInterfaceToken(DESCRIPTOR);
+ _data.writeString(name);
+ _data.writeInt(granteeUid);
+ mRemote.transact(Stub.TRANSACTION_grant, _data, _reply, 0);
+ _reply.readException();
+ _result = _reply.readInt();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ return _result;
+ }
+
+ public int ungrant(String name, int granteeUid) throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ int _result;
+ try {
+ _data.writeInterfaceToken(DESCRIPTOR);
+ _data.writeString(name);
+ _data.writeInt(granteeUid);
+ mRemote.transact(Stub.TRANSACTION_ungrant, _data, _reply, 0);
+ _reply.readException();
+ _result = _reply.readInt();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ return _result;
+ }
+
+ @Override
+ public long getmtime(String name) throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ long _result;
+ try {
+ _data.writeInterfaceToken(DESCRIPTOR);
+ _data.writeString(name);
+ mRemote.transact(Stub.TRANSACTION_getmtime, _data, _reply, 0);
+ _reply.readException();
+ _result = _reply.readLong();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ return _result;
+ }
+
+ @Override
+ public int duplicate(String srcKey, int srcUid, String destKey, int destUid)
+ throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ int _result;
+ try {
+ _data.writeInterfaceToken(DESCRIPTOR);
+ _data.writeString(srcKey);
+ _data.writeInt(srcUid);
+ _data.writeString(destKey);
+ _data.writeInt(destUid);
+ mRemote.transact(Stub.TRANSACTION_duplicate, _data, _reply, 0);
+ _reply.readException();
+ _result = _reply.readInt();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ return _result;
+ }
+ }
+
+ private static final String DESCRIPTOR = "android.security.keystore";
+
+ static final int TRANSACTION_test = IBinder.FIRST_CALL_TRANSACTION + 0;
+ static final int TRANSACTION_get = IBinder.FIRST_CALL_TRANSACTION + 1;
+ static final int TRANSACTION_insert = IBinder.FIRST_CALL_TRANSACTION + 2;
+ static final int TRANSACTION_del = IBinder.FIRST_CALL_TRANSACTION + 3;
+ static final int TRANSACTION_exist = IBinder.FIRST_CALL_TRANSACTION + 4;
+ static final int TRANSACTION_saw = IBinder.FIRST_CALL_TRANSACTION + 5;
+ static final int TRANSACTION_reset = IBinder.FIRST_CALL_TRANSACTION + 6;
+ static final int TRANSACTION_password = IBinder.FIRST_CALL_TRANSACTION + 7;
+ static final int TRANSACTION_lock = IBinder.FIRST_CALL_TRANSACTION + 8;
+ static final int TRANSACTION_unlock = IBinder.FIRST_CALL_TRANSACTION + 9;
+ static final int TRANSACTION_zero = IBinder.FIRST_CALL_TRANSACTION + 10;
+ static final int TRANSACTION_generate = IBinder.FIRST_CALL_TRANSACTION + 11;
+ static final int TRANSACTION_import = IBinder.FIRST_CALL_TRANSACTION + 12;
+ static final int TRANSACTION_sign = IBinder.FIRST_CALL_TRANSACTION + 13;
+ static final int TRANSACTION_verify = IBinder.FIRST_CALL_TRANSACTION + 14;
+ static final int TRANSACTION_get_pubkey = IBinder.FIRST_CALL_TRANSACTION + 15;
+ static final int TRANSACTION_del_key = IBinder.FIRST_CALL_TRANSACTION + 16;
+ static final int TRANSACTION_grant = IBinder.FIRST_CALL_TRANSACTION + 17;
+ static final int TRANSACTION_ungrant = IBinder.FIRST_CALL_TRANSACTION + 18;
+ static final int TRANSACTION_getmtime = IBinder.FIRST_CALL_TRANSACTION + 19;
+ static final int TRANSACTION_duplicate = IBinder.FIRST_CALL_TRANSACTION + 20;
+
+ /**
+ * Cast an IBinder object into an IKeystoreService interface, generating
+ * a proxy if needed.
+ */
+ public static IKeystoreService asInterface(IBinder obj) {
+ if (obj == null) {
+ return null;
+ }
+ IInterface iin = obj.queryLocalInterface(DESCRIPTOR);
+ if (iin != null && iin instanceof IKeystoreService) {
+ return (IKeystoreService) iin;
+ }
+ return new IKeystoreService.Stub.Proxy(obj);
+ }
+
+ /** Construct the stub at attach it to the interface. */
+ public Stub() {
+ attachInterface(this, DESCRIPTOR);
+ }
+
+ public IBinder asBinder() {
+ return this;
+ }
+
+ @Override
+ public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
+ throws RemoteException {
+ switch (code) {
+ case INTERFACE_TRANSACTION: {
+ reply.writeString(DESCRIPTOR);
+ return true;
+ }
+ case TRANSACTION_test: {
+ data.enforceInterface(DESCRIPTOR);
+ int resultCode = test();
+ reply.writeNoException();
+ reply.writeInt(resultCode);
+ return true;
+ }
+ }
+ return super.onTransact(code, data, reply, flags);
+ }
+ }
+
+ public int test() throws RemoteException;
+
+ public byte[] get(String name) throws RemoteException;
+
+ public int insert(String name, byte[] item, int uid) throws RemoteException;
+
+ public int del(String name, int uid) throws RemoteException;
+
+ public int exist(String name, int uid) throws RemoteException;
+
+ public String[] saw(String name, int uid) throws RemoteException;
+
+ public int reset() throws RemoteException;
+
+ public int password(String password) throws RemoteException;
+
+ public int lock() throws RemoteException;
+
+ public int unlock(String password) throws RemoteException;
+
+ public int zero() throws RemoteException;
+
+ public int generate(String name, int uid) throws RemoteException;
+
+ public int import_key(String name, byte[] data, int uid) throws RemoteException;
+
+ public byte[] sign(String name, byte[] data) throws RemoteException;
+
+ public int verify(String name, byte[] data, byte[] signature) throws RemoteException;
+
+ public byte[] get_pubkey(String name) throws RemoteException;
+
+ public int del_key(String name, int uid) throws RemoteException;
+
+ public int grant(String name, int granteeUid) throws RemoteException;
+
+ public int ungrant(String name, int granteeUid) throws RemoteException;
+
+ public long getmtime(String name) throws RemoteException;
+
+ public int duplicate(String srcKey, int srcUid, String destKey, int destUid)
+ throws RemoteException;
+}
diff --git a/core/java/android/server/package.html b/core/java/android/server/package.html
index c9f96a6..c9f96a6 100755..100644
--- a/core/java/android/server/package.html
+++ b/core/java/android/server/package.html
diff --git a/core/java/android/speech/tts/ITextToSpeechCallback.aidl b/core/java/android/speech/tts/ITextToSpeechCallback.aidl
index f0287d4..f0287d4 100755..100644
--- a/core/java/android/speech/tts/ITextToSpeechCallback.aidl
+++ b/core/java/android/speech/tts/ITextToSpeechCallback.aidl
diff --git a/core/java/android/speech/tts/TextToSpeech.java b/core/java/android/speech/tts/TextToSpeech.java
index 5e367cb..5e367cb 100755..100644
--- a/core/java/android/speech/tts/TextToSpeech.java
+++ b/core/java/android/speech/tts/TextToSpeech.java
diff --git a/core/java/android/text/format/DateFormat.java b/core/java/android/text/format/DateFormat.java
index 3c984b5..50b1a29 100644
--- a/core/java/android/text/format/DateFormat.java
+++ b/core/java/android/text/format/DateFormat.java
@@ -31,179 +31,85 @@ import java.util.Locale;
import java.util.TimeZone;
import java.text.SimpleDateFormat;
+import libcore.icu.LocaleData;
+
/**
- Utility class for producing strings with formatted date/time.
-
- <p>
- Most callers should avoid supplying their own format strings to this
- class' {@code format} methods and rely on the correctly localized ones
- supplied by the system. This class' factory methods return
- appropriately-localized {@link java.text.DateFormat} instances, suitable
- for both formatting and parsing dates. For the canonical documentation
- of format strings, see {@link java.text.SimpleDateFormat}.
- </p>
- <p>
- The format methods in this class takes as inputs a format string and a representation of a date/time.
- The format string controls how the output is generated.
- This class only supports a subset of the full Unicode specification.
- Use {@link java.text.SimpleDateFormat} if you need more.
- Formatting characters may be repeated in order to get more detailed representations
- of that field. For instance, the format character &apos;M&apos; is used to
- represent the month. Depending on how many times that character is repeated
- you get a different representation.
- </p>
- <p>
- For the month of September:<br/>
- M -&gt; 9<br/>
- MM -&gt; 09<br/>
- MMM -&gt; Sep<br/>
- MMMM -&gt; September
- </p>
- <p>
- The effects of the duplication vary depending on the nature of the field.
- See the notes on the individual field formatters for details. For purely numeric
- fields such as <code>HOUR</code> adding more copies of the designator will
- zero-pad the value to that number of characters.
- </p>
- <p>
- For 7 minutes past the hour:<br/>
- m -&gt; 7<br/>
- mm -&gt; 07<br/>
- mmm -&gt; 007<br/>
- mmmm -&gt; 0007
- </p>
- <p>
- Examples for April 6, 1970 at 3:23am:<br/>
- &quot;MM/dd/yy h:mmaa&quot; -&gt; &quot;04/06/70 3:23am&quot<br/>
- &quot;MMM dd, yyyy h:mmaa&quot; -&gt; &quot;Apr 6, 1970 3:23am&quot<br/>
- &quot;MMMM dd, yyyy h:mmaa&quot; -&gt; &quot;April 6, 1970 3:23am&quot<br/>
- &quot;E, MMMM dd, yyyy h:mmaa&quot; -&gt; &quot;Mon, April 6, 1970 3:23am&<br/>
- &quot;EEEE, MMMM dd, yyyy h:mmaa&quot; -&gt; &quot;Monday, April 6, 1970 3:23am&quot;<br/>
- &quot;&apos;Noteworthy day: &apos;M/d/yy&quot; -&gt; &quot;Noteworthy day: 4/6/70&quot;
+ * Utility class for producing strings with formatted date/time.
+ *
+ * <p>Most callers should avoid supplying their own format strings to this
+ * class' {@code format} methods and rely on the correctly localized ones
+ * supplied by the system. This class' factory methods return
+ * appropriately-localized {@link java.text.DateFormat} instances, suitable
+ * for both formatting and parsing dates. For the canonical documentation
+ * of format strings, see {@link java.text.SimpleDateFormat}.
+ *
+ * <p>The {@code format} methods in this class implement a subset of Unicode
+ * <a href="http://www.unicode.org/reports/tr35/#Date_Format_Patterns">UTS #35</a> patterns.
+ * The subset currently supported by this class includes the following format characters:
+ * {@code acdEHhLKkLMmsyz}. Up to API level 17, only {@code adEhkMmszy} were supported.
+ * Note that this class incorrectly implements {@code k} as if it were {@code H} for backwards
+ * compatibility.
+ *
+ * <p>See {@link java.text.SimpleDateFormat} for more documentation
+ * about patterns, or if you need a more complete or correct implementation.
+ * Note that the non-{@code format} methods in this class are implemented by
+ * {@code SimpleDateFormat}.
*/
-
public class DateFormat {
- /**
- Text in the format string that should be copied verbatim rather that
- interpreted as formatting codes must be surrounded by the <code>QUOTE</code>
- character. If you need to embed a literal <code>QUOTE</code> character in
- the output text then use two in a row.
- */
+ /** @deprecated Use a literal {@code '} instead. */
+ @Deprecated
public static final char QUOTE = '\'';
-
- /**
- This designator indicates whether the <code>HOUR</code> field is before
- or after noon. The output is lower-case.
-
- Examples:
- a -> a or p
- aa -> am or pm
- */
+
+ /** @deprecated Use a literal {@code 'a'} instead. */
+ @Deprecated
public static final char AM_PM = 'a';
- /**
- This designator indicates whether the <code>HOUR</code> field is before
- or after noon. The output is capitalized.
-
- Examples:
- A -> A or P
- AA -> AM or PM
- */
+ /** @deprecated Use a literal {@code 'a'} instead; 'A' was always equivalent to 'a'. */
+ @Deprecated
public static final char CAPITAL_AM_PM = 'A';
- /**
- This designator indicates the day of the month.
-
- Examples for the 9th of the month:
- d -> 9
- dd -> 09
- */
+ /** @deprecated Use a literal {@code 'd'} instead. */
+ @Deprecated
public static final char DATE = 'd';
- /**
- This designator indicates the name of the day of the week.
-
- Examples for Sunday:
- E -> Sun
- EEEE -> Sunday
- */
+ /** @deprecated Use a literal {@code 'E'} instead. */
+ @Deprecated
public static final char DAY = 'E';
- /**
- This designator indicates the hour of the day in 12 hour format.
-
- Examples for 3pm:
- h -> 3
- hh -> 03
- */
+ /** @deprecated Use a literal {@code 'h'} instead. */
+ @Deprecated
public static final char HOUR = 'h';
/**
- This designator indicates the hour of the day in 24 hour format.
-
- Example for 3pm:
- k -> 15
-
- Examples for midnight:
- k -> 0
- kk -> 00
+ * @deprecated Use a literal {@code 'H'} (for compatibility with {@link SimpleDateFormat}
+ * and Unicode) or {@code 'k'} (for compatibility with Android releases up to and including
+ * Jelly Bean MR-1) instead. Note that the two are incompatible.
*/
+ @Deprecated
public static final char HOUR_OF_DAY = 'k';
- /**
- This designator indicates the minute of the hour.
-
- Examples for 7 minutes past the hour:
- m -> 7
- mm -> 07
- */
+ /** @deprecated Use a literal {@code 'm'} instead. */
+ @Deprecated
public static final char MINUTE = 'm';
- /**
- This designator indicates the month of the year. See also
- {@link #STANDALONE_MONTH}.
-
- Examples for September:
- M -> 9
- MM -> 09
- MMM -> Sep
- MMMM -> September
- */
+ /** @deprecated Use a literal {@code 'M'} instead. */
+ @Deprecated
public static final char MONTH = 'M';
- /**
- This designator indicates the standalone month of the year,
- necessary in some format strings in some languages. For
- example, Russian distinguishes between the "June" in
- "June" and that in "June 2010".
- */
+ /** @deprecated Use a literal {@code 'L'} instead. */
+ @Deprecated
public static final char STANDALONE_MONTH = 'L';
- /**
- This designator indicates the seconds of the minute.
-
- Examples for 7 seconds past the minute:
- s -> 7
- ss -> 07
- */
+ /** @deprecated Use a literal {@code 's'} instead. */
+ @Deprecated
public static final char SECONDS = 's';
- /**
- This designator indicates the offset of the timezone from GMT.
-
- Example for US/Pacific timezone:
- z -> -0800
- zz -> PST
- */
+ /** @deprecated Use a literal {@code 'z'} instead. */
+ @Deprecated
public static final char TIME_ZONE = 'z';
- /**
- This designator indicates the year.
-
- Examples for 2006
- y -> 06
- yyyy -> 2006
- */
+ /** @deprecated Use a literal {@code 'y'} instead. */
+ @Deprecated
public static final char YEAR = 'y';
@@ -231,8 +137,7 @@ public class DateFormat {
}
java.text.DateFormat natural =
- java.text.DateFormat.getTimeInstance(
- java.text.DateFormat.LONG, locale);
+ java.text.DateFormat.getTimeInstance(java.text.DateFormat.LONG, locale);
if (natural instanceof SimpleDateFormat) {
SimpleDateFormat sdf = (SimpleDateFormat) natural;
@@ -265,20 +170,22 @@ public class DateFormat {
* @return the {@link java.text.DateFormat} object that properly formats the time.
*/
public static java.text.DateFormat getTimeFormat(Context context) {
- boolean b24 = is24HourFormat(context);
- int res;
-
- if (b24) {
- res = R.string.twenty_four_hour_time_format;
- } else {
- res = R.string.twelve_hour_time_format;
- }
+ return new java.text.SimpleDateFormat(getTimeFormatString(context));
+ }
- return new java.text.SimpleDateFormat(context.getString(res));
+ /**
+ * Returns a String pattern that can be used to format the time according
+ * to the current locale and the user's 12-/24-hour clock preference.
+ * @param context the application context
+ * @hide
+ */
+ public static String getTimeFormatString(Context context) {
+ LocaleData d = LocaleData.get(context.getResources().getConfiguration().locale);
+ return is24HourFormat(context) ? d.timeFormat24 : d.timeFormat12;
}
/**
- * Returns a {@link java.text.DateFormat} object that can format the date
+ * Returns a {@link java.text.DateFormat} object that can format the date
* in short form (such as 12/31/1999) according
* to the current locale and the user's date-order preference.
* @param context the application context
@@ -303,7 +210,6 @@ public class DateFormat {
public static java.text.DateFormat getDateFormatForSetting(Context context,
String value) {
String format = getDateFormatStringForSetting(context, value);
-
return new java.text.SimpleDateFormat(format);
}
@@ -347,10 +253,10 @@ public class DateFormat {
value = context.getString(R.string.numeric_date_format);
return value;
}
-
+
/**
* Returns a {@link java.text.DateFormat} object that can format the date
- * in long form (such as December 31, 1999) for the current locale.
+ * in long form (such as {@code Monday, January 3, 2000}) for the current locale.
* @param context the application context
* @return the {@link java.text.DateFormat} object that formats the date in long form.
*/
@@ -360,7 +266,7 @@ public class DateFormat {
/**
* Returns a {@link java.text.DateFormat} object that can format the date
- * in medium form (such as Dec. 31, 1999) for the current locale.
+ * in medium form (such as {@code Jan 3, 2000}) for the current locale.
* @param context the application context
* @return the {@link java.text.DateFormat} object that formats the date in long form.
*/
@@ -370,13 +276,13 @@ public class DateFormat {
/**
* Gets the current date format stored as a char array. The array will contain
- * 3 elements ({@link #DATE}, {@link #MONTH}, and {@link #YEAR}) in the order
+ * 3 elements ({@link #DATE}, {@link #MONTH}, and {@link #YEAR}) in the order
* specified by the user's format preference. Note that this order is
* only appropriate for all-numeric dates; spelled-out (MEDIUM and LONG)
* dates will generally contain other punctuation, spaces, or words,
* not just the day, month, and year, and not necessarily in the same
* order returned here.
- */
+ */
public static char[] getDateFormatOrder(Context context) {
char[] order = new char[] {DATE, MONTH, YEAR};
String value = getDateFormatString(context);
@@ -406,7 +312,7 @@ public class DateFormat {
}
return order;
}
-
+
private static String getDateFormatString(Context context) {
String value = Settings.System.getString(context.getContentResolver(),
Settings.System.DATE_FORMAT);
@@ -415,7 +321,7 @@ public class DateFormat {
}
/**
- * Given a format string and a time in milliseconds since Jan 1, 1970 GMT, returns a
+ * Given a format string and a time in milliseconds since Jan 1, 1970 GMT, returns a
* CharSequence containing the requested date.
* @param inFormat the format string, as described in {@link android.text.format.DateFormat}
* @param inTimeInMillis in milliseconds since Jan 1, 1970 GMT
@@ -433,22 +339,20 @@ public class DateFormat {
* @return a {@link CharSequence} containing the requested text
*/
public static CharSequence format(CharSequence inFormat, Date inDate) {
- Calendar c = new GregorianCalendar();
-
+ Calendar c = new GregorianCalendar();
c.setTime(inDate);
-
return format(inFormat, c);
}
/**
* Indicates whether the specified format string contains seconds.
- *
+ *
* Always returns false if the input format is null.
- *
+ *
* @param inFormat the format string, as described in {@link android.text.format.DateFormat}
- *
+ *
* @return true if the format string contains {@link #SECONDS}, false otherwise
- *
+ *
* @hide
*/
public static boolean hasSeconds(CharSequence inFormat) {
@@ -503,24 +407,23 @@ public class DateFormat {
}
/**
- * Given a format string and a {@link java.util.Calendar} object, returns a CharSequence
+ * Given a format string and a {@link java.util.Calendar} object, returns a CharSequence
* containing the requested date.
* @param inFormat the format string, as described in {@link android.text.format.DateFormat}
* @param inDate the date to format
* @return a {@link CharSequence} containing the requested text
*/
public static CharSequence format(CharSequence inFormat, Calendar inDate) {
- SpannableStringBuilder s = new SpannableStringBuilder(inFormat);
- int c;
- int count;
+ SpannableStringBuilder s = new SpannableStringBuilder(inFormat);
+ int count;
+
+ LocaleData localeData = LocaleData.get(Locale.getDefault());
int len = inFormat.length();
for (int i = 0; i < len; i += count) {
- int temp;
-
count = 1;
- c = s.charAt(i);
+ int c = s.charAt(i);
if (c == QUOTE) {
count = appendQuotedText(s, i, len);
@@ -533,102 +436,105 @@ public class DateFormat {
}
String replacement;
-
switch (c) {
- case AM_PM:
- replacement = DateUtils.getAMPMString(inDate.get(Calendar.AM_PM));
+ case 'A':
+ case 'a':
+ replacement = localeData.amPm[inDate.get(Calendar.AM_PM) - Calendar.AM];
break;
-
- case CAPITAL_AM_PM:
- //FIXME: this is the same as AM_PM? no capital?
- replacement = DateUtils.getAMPMString(inDate.get(Calendar.AM_PM));
- break;
-
- case DATE:
+ case 'd':
replacement = zeroPad(inDate.get(Calendar.DATE), count);
break;
-
- case DAY:
- temp = inDate.get(Calendar.DAY_OF_WEEK);
- replacement = DateUtils.getDayOfWeekString(temp,
- count < 4 ?
- DateUtils.LENGTH_MEDIUM :
- DateUtils.LENGTH_LONG);
+ case 'c':
+ case 'E':
+ replacement = getDayOfWeekString(localeData,
+ inDate.get(Calendar.DAY_OF_WEEK), count, c);
break;
-
- case HOUR:
- temp = inDate.get(Calendar.HOUR);
-
- if (0 == temp)
- temp = 12;
-
- replacement = zeroPad(temp, count);
+ case 'K': // hour in am/pm (0-11)
+ case 'h': // hour in am/pm (1-12)
+ {
+ int hour = inDate.get(Calendar.HOUR);
+ if (c == 'h' && hour == 0) {
+ hour = 12;
+ }
+ replacement = zeroPad(hour, count);
+ }
break;
-
- case HOUR_OF_DAY:
- replacement = zeroPad(inDate.get(Calendar.HOUR_OF_DAY), count);
+ case 'H': // hour in day (0-23)
+ case 'k': // hour in day (1-24) [but see note below]
+ {
+ int hour = inDate.get(Calendar.HOUR_OF_DAY);
+ // Historically on Android 'k' was interpreted as 'H', which wasn't
+ // implemented, so pretty much all callers that want to format 24-hour
+ // times are abusing 'k'. http://b/8359981.
+ if (false && c == 'k' && hour == 0) {
+ hour = 24;
+ }
+ replacement = zeroPad(hour, count);
+ }
break;
-
- case MINUTE:
- replacement = zeroPad(inDate.get(Calendar.MINUTE), count);
+ case 'L':
+ case 'M':
+ replacement = getMonthString(localeData,
+ inDate.get(Calendar.MONTH), count, c);
break;
-
- case MONTH:
- case STANDALONE_MONTH:
- replacement = getMonthString(inDate, count, c);
+ case 'm':
+ replacement = zeroPad(inDate.get(Calendar.MINUTE), count);
break;
-
- case SECONDS:
+ case 's':
replacement = zeroPad(inDate.get(Calendar.SECOND), count);
break;
-
- case TIME_ZONE:
- replacement = getTimeZoneString(inDate, count);
+ case 'y':
+ replacement = getYearString(inDate.get(Calendar.YEAR), count);
break;
-
- case YEAR:
- replacement = getYearString(inDate, count);
+ case 'z':
+ replacement = getTimeZoneString(inDate, count);
break;
-
default:
replacement = null;
break;
}
-
+
if (replacement != null) {
s.replace(i, i + count, replacement);
count = replacement.length(); // CARE: count is used in the for loop above
len = s.length();
}
}
-
- if (inFormat instanceof Spanned)
+
+ if (inFormat instanceof Spanned) {
return new SpannedString(s);
- else
+ } else {
return s.toString();
+ }
}
-
- private static String getMonthString(Calendar inDate, int count, int kind) {
- boolean standalone = (kind == STANDALONE_MONTH);
- int month = inDate.get(Calendar.MONTH);
-
- if (count >= 4) {
- return standalone
- ? DateUtils.getStandaloneMonthString(month, DateUtils.LENGTH_LONG)
- : DateUtils.getMonthString(month, DateUtils.LENGTH_LONG);
+
+ private static String getDayOfWeekString(LocaleData ld, int day, int count, int kind) {
+ boolean standalone = (kind == 'c');
+ if (count == 5) {
+ return standalone ? ld.tinyStandAloneWeekdayNames[day] : ld.tinyWeekdayNames[day];
+ } else if (count == 4) {
+ return standalone ? ld.longStandAloneWeekdayNames[day] : ld.longWeekdayNames[day];
+ } else {
+ return standalone ? ld.shortStandAloneWeekdayNames[day] : ld.shortWeekdayNames[day];
+ }
+ }
+
+ private static String getMonthString(LocaleData ld, int month, int count, int kind) {
+ boolean standalone = (kind == 'L');
+ if (count == 5) {
+ return standalone ? ld.tinyStandAloneMonthNames[month] : ld.tinyMonthNames[month];
+ } else if (count == 4) {
+ return standalone ? ld.longStandAloneMonthNames[month] : ld.longMonthNames[month];
} else if (count == 3) {
- return standalone
- ? DateUtils.getStandaloneMonthString(month, DateUtils.LENGTH_MEDIUM)
- : DateUtils.getMonthString(month, DateUtils.LENGTH_MEDIUM);
+ return standalone ? ld.shortStandAloneMonthNames[month] : ld.shortMonthNames[month];
} else {
// Calendar.JANUARY == 0, so add 1 to month.
return zeroPad(month+1, count);
}
}
-
+
private static String getTimeZoneString(Calendar inDate, int count) {
TimeZone tz = inDate.getTimeZone();
-
if (count < 2) { // FIXME: shouldn't this be <= 2 ?
return formatZoneOffset(inDate.get(Calendar.DST_OFFSET) +
inDate.get(Calendar.ZONE_OFFSET),
@@ -657,13 +563,12 @@ public class DateFormat {
tb.append(zeroPad(minutes, 2));
return tb.toString();
}
-
- private static String getYearString(Calendar inDate, int count) {
- int year = inDate.get(Calendar.YEAR);
+
+ private static String getYearString(int year, int count) {
return (count <= 2) ? zeroPad(year % 100, 2)
: String.format(Locale.getDefault(), "%d", year);
}
-
+
private static int appendQuotedText(SpannableStringBuilder s, int i, int len) {
if (i + 1 < len && s.charAt(i + 1) == QUOTE) {
s.delete(i, i + 1);
diff --git a/core/java/android/text/format/DateUtils.java b/core/java/android/text/format/DateUtils.java
index bcce61d..5a88cf6 100644
--- a/core/java/android/text/format/DateUtils.java
+++ b/core/java/android/text/format/DateUtils.java
@@ -39,15 +39,9 @@ public class DateUtils
{
private static final Object sLock = new Object();
private static Configuration sLastConfig;
- private static java.text.DateFormat sStatusTimeFormat;
private static String sElapsedFormatMMSS;
private static String sElapsedFormatHMMSS;
- private static final String FAST_FORMAT_HMMSS = "%1$d:%2$02d:%3$02d";
- private static final String FAST_FORMAT_MMSS = "%1$02d:%2$02d";
- private static final char TIME_SEPARATOR = ':';
-
-
public static final long SECOND_IN_MILLIS = 1000;
public static final long MINUTE_IN_MILLIS = SECOND_IN_MILLIS * 60;
public static final long HOUR_IN_MILLIS = MINUTE_IN_MILLIS * 60;
@@ -100,14 +94,14 @@ public class DateUtils
// translated.
/**
* This is not actually the preferred 24-hour date format in all locales.
- * @deprecated use {@link java.text.SimpleDateFormat} instead.
+ * @deprecated Use {@link java.text.SimpleDateFormat} instead.
*/
@Deprecated
public static final String HOUR_MINUTE_24 = "%H:%M";
public static final String MONTH_FORMAT = "%B";
/**
* This is not actually a useful month name in all locales.
- * @deprecated use {@link java.text.SimpleDateFormat} instead.
+ * @deprecated Use {@link java.text.SimpleDateFormat} instead.
*/
@Deprecated
public static final String ABBREV_MONTH_FORMAT = "%b";
@@ -123,7 +117,7 @@ public class DateUtils
// The index is constructed from a bit-wise OR of the boolean values:
// {showTime, showYear, showWeekDay}. For example, if showYear and
// showWeekDay are both true, then the index would be 3.
- /** @deprecated do not use. */
+ /** @deprecated Do not use. */
public static final int sameYearTable[] = {
com.android.internal.R.string.same_year_md1_md2,
com.android.internal.R.string.same_year_wday1_md1_wday2_md2,
@@ -150,7 +144,7 @@ public class DateUtils
// The index is constructed from a bit-wise OR of the boolean values:
// {showTime, showYear, showWeekDay}. For example, if showYear and
// showWeekDay are both true, then the index would be 3.
- /** @deprecated do not use. */
+ /** @deprecated Do not use. */
public static final int sameMonthTable[] = {
com.android.internal.R.string.same_month_md1_md2,
com.android.internal.R.string.same_month_wday1_md1_wday2_md2,
@@ -177,7 +171,7 @@ public class DateUtils
*
* @more <p>
* e.g. "Sunday" or "January"
- * @deprecated use {@link java.text.SimpleDateFormat} instead.
+ * @deprecated Use {@link java.text.SimpleDateFormat} instead.
*/
@Deprecated
public static final int LENGTH_LONG = 10;
@@ -188,7 +182,7 @@ public class DateUtils
*
* @more <p>
* e.g. "Sun" or "Jan"
- * @deprecated use {@link java.text.SimpleDateFormat} instead.
+ * @deprecated Use {@link java.text.SimpleDateFormat} instead.
*/
@Deprecated
public static final int LENGTH_MEDIUM = 20;
@@ -200,7 +194,7 @@ public class DateUtils
* <p>e.g. "Su" or "Jan"
* <p>In most languages, the results returned for LENGTH_SHORT will be the same as
* the results returned for {@link #LENGTH_MEDIUM}.
- * @deprecated use {@link java.text.SimpleDateFormat} instead.
+ * @deprecated Use {@link java.text.SimpleDateFormat} instead.
*/
@Deprecated
public static final int LENGTH_SHORT = 30;
@@ -209,7 +203,7 @@ public class DateUtils
* Request an even shorter abbreviated version of the name.
* Do not use this. Currently this will always return the same result
* as {@link #LENGTH_SHORT}.
- * @deprecated use {@link java.text.SimpleDateFormat} instead.
+ * @deprecated Use {@link java.text.SimpleDateFormat} instead.
*/
@Deprecated
public static final int LENGTH_SHORTER = 40;
@@ -221,7 +215,7 @@ public class DateUtils
* <p>e.g. "S", "T", "T" or "J"
* <p>In some languages, the results returned for LENGTH_SHORTEST will be the same as
* the results returned for {@link #LENGTH_SHORT}.
- * @deprecated use {@link java.text.SimpleDateFormat} instead.
+ * @deprecated Use {@link java.text.SimpleDateFormat} instead.
*/
@Deprecated
public static final int LENGTH_SHORTEST = 50;
@@ -237,7 +231,7 @@ public class DateUtils
* Undefined lengths will return {@link #LENGTH_MEDIUM}
* but may return something different in the future.
* @throws IndexOutOfBoundsException if the dayOfWeek is out of bounds.
- * @deprecated use {@link java.text.SimpleDateFormat} instead.
+ * @deprecated Use {@link java.text.SimpleDateFormat} instead.
*/
@Deprecated
public static String getDayOfWeekString(int dayOfWeek, int abbrev) {
@@ -259,7 +253,7 @@ public class DateUtils
* @param ampm Either {@link Calendar#AM Calendar.AM} or {@link Calendar#PM Calendar.PM}.
* @throws IndexOutOfBoundsException if the ampm is out of bounds.
* @return Localized version of "AM" or "PM".
- * @deprecated use {@link java.text.SimpleDateFormat} instead.
+ * @deprecated Use {@link java.text.SimpleDateFormat} instead.
*/
@Deprecated
public static String getAMPMString(int ampm) {
@@ -275,14 +269,10 @@ public class DateUtils
* Undefined lengths will return {@link #LENGTH_MEDIUM}
* but may return something different in the future.
* @return Localized month of the year.
- * @deprecated use {@link java.text.SimpleDateFormat} instead.
+ * @deprecated Use {@link java.text.SimpleDateFormat} instead.
*/
@Deprecated
public static String getMonthString(int month, int abbrev) {
- // Note that here we use d.shortMonthNames for MEDIUM, SHORT and SHORTER.
- // This is a shortcut to not spam the translators with too many variations
- // of the same string. If we find that in a language the distinction
- // is necessary, we can can add more without changing this API.
LocaleData d = LocaleData.get(Locale.getDefault());
String[] names;
switch (abbrev) {
@@ -297,41 +287,6 @@ public class DateUtils
}
/**
- * Return a localized string for the month of the year, for
- * contexts where the month is not formatted together with
- * a day of the month.
- *
- * @param month One of {@link Calendar#JANUARY Calendar.JANUARY},
- * {@link Calendar#FEBRUARY Calendar.FEBRUARY}, etc.
- * @param abbrev One of {@link #LENGTH_LONG}, {@link #LENGTH_MEDIUM},
- * or {@link #LENGTH_SHORTEST}.
- * Undefined lengths will return {@link #LENGTH_MEDIUM}
- * but may return something different in the future.
- * @return Localized month of the year.
- * @hide Pending API council approval
- * @deprecated use {@link java.text.SimpleDateFormat} instead.
- */
- @Deprecated
- public static String getStandaloneMonthString(int month, int abbrev) {
- // Note that here we use d.shortMonthNames for MEDIUM, SHORT and SHORTER.
- // This is a shortcut to not spam the translators with too many variations
- // of the same string. If we find that in a language the distinction
- // is necessary, we can can add more without changing this API.
- LocaleData d = LocaleData.get(Locale.getDefault());
- String[] names;
- switch (abbrev) {
- case LENGTH_LONG: names = d.longStandAloneMonthNames;
- break;
- case LENGTH_MEDIUM: names = d.shortMonthNames; break;
- case LENGTH_SHORT: names = d.shortMonthNames; break;
- case LENGTH_SHORTER: names = d.shortMonthNames; break;
- case LENGTH_SHORTEST: names = d.tinyMonthNames; break;
- default: names = d.shortMonthNames; break;
- }
- return names[month];
- }
-
- /**
* Returns a string describing the elapsed time since startTime.
* @param startTime some time in the past.
* @return a String object containing the elapsed time.
@@ -434,20 +389,7 @@ public class DateUtils
}
}
} else if (duration < WEEK_IN_MILLIS && minResolution < WEEK_IN_MILLIS) {
- count = getNumberOfDaysPassed(time, now);
- if (past) {
- if (abbrevRelative) {
- resId = com.android.internal.R.plurals.abbrev_num_days_ago;
- } else {
- resId = com.android.internal.R.plurals.num_days_ago;
- }
- } else {
- if (abbrevRelative) {
- resId = com.android.internal.R.plurals.abbrev_in_num_days;
- } else {
- resId = com.android.internal.R.plurals.in_num_days;
- }
- }
+ return getRelativeDayString(r, time, now);
} else {
// We know that we won't be showing the time, so it is safe to pass
// in a null context.
@@ -459,24 +401,6 @@ public class DateUtils
}
/**
- * Returns the number of days passed between two dates.
- *
- * @param date1 first date
- * @param date2 second date
- * @return number of days passed between to dates.
- */
- private synchronized static long getNumberOfDaysPassed(long date1, long date2) {
- if (sThenTime == null) {
- sThenTime = new Time();
- }
- sThenTime.set(date1);
- int day1 = Time.getJulianDay(date1, sThenTime.gmtoff);
- sThenTime.set(date2);
- int day2 = Time.getJulianDay(date2, sThenTime.gmtoff);
- return Math.abs(day2 - day1);
- }
-
- /**
* Return string describing the elapsed time since startTime formatted like
* "[relative time/date], [time]".
* <p>
@@ -534,28 +458,29 @@ public class DateUtils
* today this function returns "Today", if the day was a week ago it returns "7 days ago", and
* if the day is in 2 weeks it returns "in 14 days".
*
- * @param r the resources to get the strings from
+ * @param r the resources
* @param day the relative day to describe in UTC milliseconds
* @param today the current time in UTC milliseconds
- * @return a formatting string
*/
private static final String getRelativeDayString(Resources r, long day, long today) {
+ Locale locale = r.getConfiguration().locale;
+ if (locale == null) {
+ locale = Locale.getDefault();
+ }
+
+ // TODO: use TimeZone.getOffset instead.
Time startTime = new Time();
startTime.set(day);
+ int startDay = Time.getJulianDay(day, startTime.gmtoff);
+
Time currentTime = new Time();
currentTime.set(today);
-
- int startDay = Time.getJulianDay(day, startTime.gmtoff);
int currentDay = Time.getJulianDay(today, currentTime.gmtoff);
int days = Math.abs(currentDay - startDay);
boolean past = (today > day);
// TODO: some locales name other days too, such as de_DE's "Vorgestern" (today - 2).
- Locale locale = r.getConfiguration().locale;
- if (locale == null) {
- locale = Locale.getDefault();
- }
if (days == 1) {
if (past) {
return LocaleData.get(locale).yesterday;
@@ -588,25 +513,12 @@ public class DateUtils
Configuration cfg = r.getConfiguration();
if (sLastConfig == null || !sLastConfig.equals(cfg)) {
sLastConfig = cfg;
- sStatusTimeFormat = java.text.DateFormat.getTimeInstance(java.text.DateFormat.SHORT);
sElapsedFormatMMSS = r.getString(com.android.internal.R.string.elapsed_time_short_format_mm_ss);
sElapsedFormatHMMSS = r.getString(com.android.internal.R.string.elapsed_time_short_format_h_mm_ss);
}
}
/**
- * Format a time so it appears like it would in the status bar clock.
- * @deprecated use {@link #DateFormat.getTimeFormat(Context)} instead.
- * @hide
- */
- public static final CharSequence timeString(long millis) {
- synchronized (sLock) {
- initFormatStringsLocked();
- return sStatusTimeFormat.format(millis);
- }
- }
-
- /**
* Return given duration in a human-friendly format. For example, "4
* minutes" or "1 second". Returns only largest meaningful unit of time,
* from seconds up to hours.
@@ -640,19 +552,18 @@ public class DateUtils
}
/**
- * Formats an elapsed time in the form "MM:SS" or "H:MM:SS"
- * for display on the call-in-progress screen.
+ * Formats an elapsed time in a format like "MM:SS" or "H:MM:SS" (using a form
+ * suited to the current locale), similar to that used on the call-in-progress
+ * screen.
*
- * @param recycle {@link StringBuilder} to recycle, if possible
+ * @param recycle {@link StringBuilder} to recycle, or null to use a temporary one.
* @param elapsedSeconds the elapsed time in seconds.
*/
public static String formatElapsedTime(StringBuilder recycle, long elapsedSeconds) {
- initFormatStrings();
-
+ // Break the elapsed seconds into hours, minutes, and seconds.
long hours = 0;
long minutes = 0;
long seconds = 0;
-
if (elapsedSeconds >= 3600) {
hours = elapsedSeconds / 3600;
elapsedSeconds -= hours * 3600;
@@ -663,70 +574,23 @@ public class DateUtils
}
seconds = elapsedSeconds;
- String result;
- if (hours > 0) {
- return formatElapsedTime(recycle, sElapsedFormatHMMSS, hours, minutes, seconds);
- } else {
- return formatElapsedTime(recycle, sElapsedFormatMMSS, minutes, seconds);
- }
- }
-
- private static void append(StringBuilder sb, long value, boolean pad, char zeroDigit) {
- if (value < 10) {
- if (pad) {
- sb.append(zeroDigit);
- }
- } else {
- sb.append((char) (zeroDigit + (value / 10)));
- }
- sb.append((char) (zeroDigit + (value % 10)));
- }
-
- /**
- * Fast formatting of h:mm:ss.
- */
- private static String formatElapsedTime(StringBuilder recycle, String format, long hours,
- long minutes, long seconds) {
- if (FAST_FORMAT_HMMSS.equals(format)) {
- char zeroDigit = LocaleData.get(Locale.getDefault()).zeroDigit;
-
- StringBuilder sb = recycle;
- if (sb == null) {
- sb = new StringBuilder(8);
- } else {
- sb.setLength(0);
- }
- append(sb, hours, false, zeroDigit);
- sb.append(TIME_SEPARATOR);
- append(sb, minutes, true, zeroDigit);
- sb.append(TIME_SEPARATOR);
- append(sb, seconds, true, zeroDigit);
- return sb.toString();
+ // Create a StringBuilder if we weren't given one to recycle.
+ // TODO: if we cared, we could have a thread-local temporary StringBuilder.
+ StringBuilder sb = recycle;
+ if (sb == null) {
+ sb = new StringBuilder(8);
} else {
- return String.format(format, hours, minutes, seconds);
+ sb.setLength(0);
}
- }
- /**
- * Fast formatting of mm:ss.
- */
- private static String formatElapsedTime(StringBuilder recycle, String format, long minutes,
- long seconds) {
- if (FAST_FORMAT_MMSS.equals(format)) {
- char zeroDigit = LocaleData.get(Locale.getDefault()).zeroDigit;
-
- StringBuilder sb = recycle;
- if (sb == null) {
- sb = new StringBuilder(8);
- } else {
- sb.setLength(0);
- }
- append(sb, minutes, false, zeroDigit);
- sb.append(TIME_SEPARATOR);
- append(sb, seconds, true, zeroDigit);
- return sb.toString();
+ // Format the broken-down time in a locale-appropriate way.
+ // TODO: use icu4c when http://unicode.org/cldr/trac/ticket/3407 is fixed.
+ Formatter f = new Formatter(sb, Locale.getDefault());
+ initFormatStrings();
+ if (hours > 0) {
+ return f.format(sElapsedFormatHMMSS, hours, minutes, seconds).toString();
} else {
- return String.format(format, minutes, seconds);
+ return f.format(sElapsedFormatMMSS, minutes, seconds).toString();
}
}
@@ -768,18 +632,6 @@ public class DateUtils
}
/**
- * @hide
- * @deprecated use {@link android.text.format.Time}
- */
- public static Calendar newCalendar(boolean zulu)
- {
- if (zulu)
- return Calendar.getInstance(TimeZone.getTimeZone("GMT"));
-
- return Calendar.getInstance();
- }
-
- /**
* @return true if the supplied when is today else false
*/
public static boolean isToday(long when) {
@@ -797,127 +649,6 @@ public class DateUtils
}
/**
- * @hide
- * @deprecated use {@link android.text.format.Time}
- * Return true if this date string is local time
- */
- public static boolean isUTC(String s)
- {
- if (s.length() == 16 && s.charAt(15) == 'Z') {
- return true;
- }
- if (s.length() == 9 && s.charAt(8) == 'Z') {
- // XXX not sure if this case possible/valid
- return true;
- }
- return false;
- }
-
- /**
- * Return a string containing the date and time in RFC2445 format.
- * Ensures that the time is written in UTC. The Calendar class doesn't
- * really help out with this, so this is slower than it ought to be.
- *
- * @param cal the date and time to write
- * @hide
- * @deprecated use {@link android.text.format.Time}
- */
- public static String writeDateTime(Calendar cal)
- {
- TimeZone tz = TimeZone.getTimeZone("GMT");
- GregorianCalendar c = new GregorianCalendar(tz);
- c.setTimeInMillis(cal.getTimeInMillis());
- return writeDateTime(c, true);
- }
-
- /**
- * Return a string containing the date and time in RFC2445 format.
- *
- * @param cal the date and time to write
- * @param zulu If the calendar is in UTC, pass true, and a Z will
- * be written at the end as per RFC2445. Otherwise, the time is
- * considered in localtime.
- * @hide
- * @deprecated use {@link android.text.format.Time}
- */
- public static String writeDateTime(Calendar cal, boolean zulu)
- {
- StringBuilder sb = new StringBuilder();
- sb.ensureCapacity(16);
- if (zulu) {
- sb.setLength(16);
- sb.setCharAt(15, 'Z');
- } else {
- sb.setLength(15);
- }
- return writeDateTime(cal, sb);
- }
-
- /**
- * Return a string containing the date and time in RFC2445 format.
- *
- * @param cal the date and time to write
- * @param sb a StringBuilder to use. It is assumed that setLength
- * has already been called on sb to the appropriate length
- * which is sb.setLength(zulu ? 16 : 15)
- * @hide
- * @deprecated use {@link android.text.format.Time}
- */
- public static String writeDateTime(Calendar cal, StringBuilder sb)
- {
- int n;
-
- n = cal.get(Calendar.YEAR);
- sb.setCharAt(3, (char)('0'+n%10));
- n /= 10;
- sb.setCharAt(2, (char)('0'+n%10));
- n /= 10;
- sb.setCharAt(1, (char)('0'+n%10));
- n /= 10;
- sb.setCharAt(0, (char)('0'+n%10));
-
- n = cal.get(Calendar.MONTH) + 1;
- sb.setCharAt(5, (char)('0'+n%10));
- n /= 10;
- sb.setCharAt(4, (char)('0'+n%10));
-
- n = cal.get(Calendar.DAY_OF_MONTH);
- sb.setCharAt(7, (char)('0'+n%10));
- n /= 10;
- sb.setCharAt(6, (char)('0'+n%10));
-
- sb.setCharAt(8, 'T');
-
- n = cal.get(Calendar.HOUR_OF_DAY);
- sb.setCharAt(10, (char)('0'+n%10));
- n /= 10;
- sb.setCharAt(9, (char)('0'+n%10));
-
- n = cal.get(Calendar.MINUTE);
- sb.setCharAt(12, (char)('0'+n%10));
- n /= 10;
- sb.setCharAt(11, (char)('0'+n%10));
-
- n = cal.get(Calendar.SECOND);
- sb.setCharAt(14, (char)('0'+n%10));
- n /= 10;
- sb.setCharAt(13, (char)('0'+n%10));
-
- return sb.toString();
- }
-
- /**
- * @hide
- * @deprecated use {@link android.text.format.Time}
- */
- public static void assign(Calendar lval, Calendar rval)
- {
- // there should be a faster way.
- lval.clear();
- lval.setTimeInMillis(rval.getTimeInMillis());
- }
-
- /**
* Formats a date or a time range according to the local conventions.
* <p>
* Note that this is a convenience method. Using it involves creating an
@@ -1149,30 +880,34 @@ public class DateUtils
// computation below that'd otherwise be thrown out.
boolean isInstant = (startMillis == endMillis);
- Time startDate;
+ Calendar startCalendar, endCalendar;
+ Time startDate = new Time();
if (timeZone != null) {
- startDate = new Time(timeZone);
+ startCalendar = Calendar.getInstance(TimeZone.getTimeZone(timeZone));
} else if (useUTC) {
- startDate = new Time(Time.TIMEZONE_UTC);
+ startCalendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
} else {
- startDate = new Time();
+ startCalendar = Calendar.getInstance();
}
- startDate.set(startMillis);
+ startCalendar.setTimeInMillis(startMillis);
+ setTimeFromCalendar(startDate, startCalendar);
- Time endDate;
+ Time endDate = new Time();
int dayDistance;
if (isInstant) {
endDate = startDate;
dayDistance = 0;
} else {
if (timeZone != null) {
- endDate = new Time(timeZone);
+ endCalendar = Calendar.getInstance(TimeZone.getTimeZone(timeZone));
} else if (useUTC) {
- endDate = new Time(Time.TIMEZONE_UTC);
+ endCalendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
} else {
- endDate = new Time();
+ endCalendar = Calendar.getInstance();
}
- endDate.set(endMillis);
+ endCalendar.setTimeInMillis(endMillis);
+ setTimeFromCalendar(endDate, endCalendar);
+
int startJulianDay = Time.getJulianDay(startMillis, startDate.gmtoff);
int endJulianDay = Time.getJulianDay(endMillis, endDate.gmtoff);
dayDistance = endJulianDay - startJulianDay;
@@ -1515,6 +1250,20 @@ public class DateUtils
return formatter.format(fullFormat, timeString, startWeekDayString, dateString);
}
+ private static void setTimeFromCalendar(Time t, Calendar c) {
+ t.hour = c.get(Calendar.HOUR_OF_DAY);
+ t.minute = c.get(Calendar.MINUTE);
+ t.month = c.get(Calendar.MONTH);
+ t.monthDay = c.get(Calendar.DAY_OF_MONTH);
+ t.second = c.get(Calendar.SECOND);
+ t.weekDay = c.get(Calendar.DAY_OF_WEEK) - 1;
+ t.year = c.get(Calendar.YEAR);
+ t.yearDay = c.get(Calendar.DAY_OF_YEAR);
+ t.isDst = (c.get(Calendar.DST_OFFSET) != 0) ? 1 : 0;
+ t.gmtoff = c.get(Calendar.ZONE_OFFSET) + c.get(Calendar.DST_OFFSET);
+ t.timezone = c.getTimeZone().getID();
+ }
+
/**
* Formats a date or a time according to the local conventions. There are
* lots of options that allow the caller to control, for example, if the
diff --git a/core/java/android/text/format/Formatter.java b/core/java/android/text/format/Formatter.java
index 121c6f2..9c98b98 100644
--- a/core/java/android/text/format/Formatter.java
+++ b/core/java/android/text/format/Formatter.java
@@ -95,16 +95,12 @@ public final class Formatter {
}
/**
- * Returns a string in the canonical IP format ###.###.###.### from a packed integer containing
- * the IP address. The IP address is expected to be in little-endian format (LSB first). That
- * is, 0x01020304 will return "4.3.2.1".
+ * Returns a string in the canonical IPv4 format ###.###.###.### from a packed integer
+ * containing the IP address. The IPv4 address is expected to be in little-endian
+ * format (LSB first). That is, 0x01020304 will return "4.3.2.1".
*
- * @param ipv4Address the IP address as a packed integer with LSB first.
- * @return string with canonical IP address format.
- *
- * @deprecated this method doesn't support IPv6 addresses. Prefer {@link
- * java.net.InetAddress#getHostAddress()}, which supports both IPv4 and
- * IPv6 addresses.
+ * @deprecated Use {@link java.net.InetAddress#getHostAddress()}, which supports both IPv4 and
+ * IPv6 addresses. This method does not support IPv6 addresses.
*/
@Deprecated
public static String formatIpAddress(int ipv4Address) {
diff --git a/core/java/android/text/format/Time.java b/core/java/android/text/format/Time.java
index 200b57b..5ef86b1 100644
--- a/core/java/android/text/format/Time.java
+++ b/core/java/android/text/format/Time.java
@@ -411,6 +411,9 @@ public class Time {
* @throws android.util.TimeFormatException if s cannot be parsed.
*/
public boolean parse(String s) {
+ if (s == null) {
+ throw new NullPointerException("time string is null");
+ }
if (nativeParse(s)) {
timezone = TIMEZONE_UTC;
return true;
diff --git a/core/java/android/util/FloatMath.java b/core/java/android/util/FloatMath.java
index 9556223..0ffd5bd 100644
--- a/core/java/android/util/FloatMath.java
+++ b/core/java/android/util/FloatMath.java
@@ -17,12 +17,10 @@
package android.util;
/**
- * Math routines similar to those found in {@link java.lang.Math}. Performs
- * computations on {@code float} values directly without incurring the overhead
- * of conversions to and from {@code double}.
- *
- * <p>On one platform, {@code FloatMath.sqrt(100)} executes in one third of the
- * time required by {@code java.lang.Math.sqrt(100)}.</p>
+ * Math routines similar to those found in {@link java.lang.Math}. On
+ * versions of Android with a JIT, these are significantly slower than
+ * the equivalent {@code Math} functions, which should be used in preference
+ * to these.
*/
public class FloatMath {
diff --git a/core/java/android/util/Patterns.java b/core/java/android/util/Patterns.java
index 152827d..9522112 100644
--- a/core/java/android/util/Patterns.java
+++ b/core/java/android/util/Patterns.java
@@ -169,10 +169,10 @@ public class Patterns {
* </ul>
*/
public static final Pattern PHONE
- = Pattern.compile( // sdd = space, dot, or dash
- "(\\+[0-9]+[\\- \\.]*)?" // +<digits><sdd>*
- + "(\\([0-9]+\\)[\\- \\.]*)?" // (<digits>)<sdd>*
- + "([0-9][0-9\\- \\.][0-9\\- \\.]+[0-9])"); // <digit><digit|sdd>+<digit>
+ = Pattern.compile( // sdd = space, dot, or dash
+ "(\\+[0-9]+[\\- \\.]*)?" // +<digits><sdd>*
+ + "(\\([0-9]+\\)[\\- \\.]*)?" // (<digits>)<sdd>*
+ + "([0-9][0-9\\- \\.]+[0-9])"); // <digit><digit|sdd>+<digit>
/**
* Convenience method to take all of the non-null matching groups in a
diff --git a/core/java/android/util/PropertyValueModel.java b/core/java/android/util/PropertyValueModel.java
deleted file mode 100755
index eb9c47d..0000000
--- a/core/java/android/util/PropertyValueModel.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.util;
-
-/**
- * A value model for a {@link Property property} of a host object. This class can be used for
- * both reflective and non-reflective property implementations.
- *
- * @param <H> the host type, where the host is the object that holds this property
- * @param <T> the value type
- *
- * @see Property
- * @see ValueModel
- */
-public class PropertyValueModel<H, T> extends ValueModel<T> {
- private final H mHost;
- private final Property<H, T> mProperty;
-
- private PropertyValueModel(H host, Property<H, T> property) {
- mProperty = property;
- mHost = host;
- }
-
- /**
- * Returns the host.
- *
- * @return the host
- */
- public H getHost() {
- return mHost;
- }
-
- /**
- * Returns the property.
- *
- * @return the property
- */
- public Property<H, T> getProperty() {
- return mProperty;
- }
-
- @Override
- public Class<T> getType() {
- return mProperty.getType();
- }
-
- @Override
- public T get() {
- return mProperty.get(mHost);
- }
-
- @Override
- public void set(T value) {
- mProperty.set(mHost, value);
- }
-
- /**
- * Return an appropriate PropertyValueModel for this host and property.
- *
- * @param host the host
- * @param property the property
- * @return the value model
- */
- public static <H, T> PropertyValueModel<H, T> of(H host, Property<H, T> property) {
- return new PropertyValueModel<H, T>(host, property);
- }
-
- /**
- * Return a PropertyValueModel for this {@code host} and a
- * reflective property, constructed from this {@code propertyType} and {@code propertyName}.
- *
- * @param host
- * @param propertyType the property type
- * @param propertyName the property name
- * @return a value model with this host and a reflective property with this type and name
- *
- * @see Property#of
- */
- public static <H, T> PropertyValueModel<H, T> of(H host, Class<T> propertyType,
- String propertyName) {
- return of(host, Property.of((Class<H>) host.getClass(), propertyType, propertyName));
- }
-
- private static Class getNullaryMethodReturnType(Class c, String name) {
- try {
- return c.getMethod(name).getReturnType();
- } catch (NoSuchMethodException e) {
- return null;
- }
- }
-
- private static Class getFieldType(Class c, String name) {
- try {
- return c.getField(name).getType();
- } catch (NoSuchFieldException e) {
- return null;
- }
- }
-
- private static String capitalize(String name) {
- if (name.isEmpty()) {
- return name;
- }
- return Character.toUpperCase(name.charAt(0)) + name.substring(1);
- }
-
- /**
- * Return a PropertyValueModel for this {@code host} and and {@code propertyName}.
- *
- * @param host the host
- * @param propertyName the property name
- * @return a value model with this host and a reflective property with this name
- */
- public static PropertyValueModel of(Object host, String propertyName) {
- Class clazz = host.getClass();
- String suffix = capitalize(propertyName);
- Class propertyType = getNullaryMethodReturnType(clazz, "get" + suffix);
- if (propertyType == null) {
- propertyType = getNullaryMethodReturnType(clazz, "is" + suffix);
- }
- if (propertyType == null) {
- propertyType = getFieldType(clazz, propertyName);
- }
- if (propertyType == null) {
- throw new NoSuchPropertyException(propertyName);
- }
- return of(host, propertyType, propertyName);
- }
-}
diff --git a/core/java/android/util/ValueModel.java b/core/java/android/util/ValueModel.java
deleted file mode 100755
index 4789682..0000000
--- a/core/java/android/util/ValueModel.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.util;
-
-/**
- * A ValueModel is an abstraction for a 'slot' or place in memory in which a value
- * may be stored and retrieved. A common implementation of ValueModel is a regular property of
- * an object, whose value may be retrieved by calling the appropriate <em>getter</em>
- * method and set by calling the corresponding <em>setter</em> method.
- *
- * @param <T> the value type
- *
- * @see PropertyValueModel
- */
-public abstract class ValueModel<T> {
- /**
- * The empty model should be used in place of {@code null} to indicate that a
- * model has not been set. The empty model has no value and does nothing when it is set.
- */
- public static final ValueModel EMPTY = new ValueModel() {
- @Override
- public Class getType() {
- return Object.class;
- }
-
- @Override
- public Object get() {
- return null;
- }
-
- @Override
- public void set(Object value) {
-
- }
- };
-
- protected ValueModel() {
- }
-
- /**
- * Returns the type of this property.
- *
- * @return the property type
- */
- public abstract Class<T> getType();
-
- /**
- * Returns the value of this property.
- *
- * @return the property value
- */
- public abstract T get();
-
- /**
- * Sets the value of this property.
- *
- * @param value the new value for this property
- */
- public abstract void set(T value);
-} \ No newline at end of file
diff --git a/core/java/android/view/InputDevice.java b/core/java/android/view/InputDevice.java
index 3bb9c01..3bb9c01 100755..100644
--- a/core/java/android/view/InputDevice.java
+++ b/core/java/android/view/InputDevice.java
diff --git a/core/java/android/view/InputEvent.java b/core/java/android/view/InputEvent.java
index ef810a3..ef810a3 100755..100644
--- a/core/java/android/view/InputEvent.java
+++ b/core/java/android/view/InputEvent.java
diff --git a/core/java/android/view/KeyEvent.java b/core/java/android/view/KeyEvent.java
index c2a3e58..c2a3e58 100755..100644
--- a/core/java/android/view/KeyEvent.java
+++ b/core/java/android/view/KeyEvent.java
diff --git a/core/java/android/view/OrientationEventListener.java b/core/java/android/view/OrientationEventListener.java
index cd48a4f..cd48a4f 100755..100644
--- a/core/java/android/view/OrientationEventListener.java
+++ b/core/java/android/view/OrientationEventListener.java
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index cf61599..4a3162f 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -8071,8 +8071,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
// in onHoverEvent.
// Note that onGenericMotionEvent will be called by default when
// onHoverEvent returns false (refer to dispatchGenericMotionEvent).
- dispatchGenericMotionEventInternal(event);
- return true;
+ return dispatchGenericMotionEventInternal(event);
}
return false;
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 58e6fbe..3b91e00 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -3751,6 +3751,12 @@ public final class ViewRootImpl implements ViewParent,
if (mView.dispatchUnhandledMove(focused, direction)) {
return EVENT_HANDLED;
}
+ } else {
+ // find the best view to give focus to in this non-touch-mode with no-focus
+ View v = focusSearch(null, direction);
+ if (v != null && v.requestFocus(direction)) {
+ return EVENT_HANDLED;
+ }
}
}
}
diff --git a/core/java/android/view/ViewStub.java b/core/java/android/view/ViewStub.java
index 69a26c2..a5dc3ae 100644
--- a/core/java/android/view/ViewStub.java
+++ b/core/java/android/view/ViewStub.java
@@ -212,7 +212,8 @@ public final class ViewStub extends View {
/**
* When visibility is set to {@link #VISIBLE} or {@link #INVISIBLE},
* {@link #inflate()} is invoked and this StubbedView is replaced in its parent
- * by the inflated layout resource.
+ * by the inflated layout resource. After that calls to this function are passed
+ * through to the inflated view.
*
* @param visibility One of {@link #VISIBLE}, {@link #INVISIBLE}, or {@link #GONE}.
*
diff --git a/core/java/android/view/WindowManager.aidl b/core/java/android/view/WindowManager.aidl
index 556dc72..556dc72 100755..100644
--- a/core/java/android/view/WindowManager.aidl
+++ b/core/java/android/view/WindowManager.aidl
diff --git a/core/java/android/view/WindowOrientationListener.java b/core/java/android/view/WindowOrientationListener.java
index 4c34dd4..bf77c67 100755..100644
--- a/core/java/android/view/WindowOrientationListener.java
+++ b/core/java/android/view/WindowOrientationListener.java
@@ -98,6 +98,7 @@ public abstract class WindowOrientationListener {
if (LOG) {
Log.d(TAG, "WindowOrientationListener enabled");
}
+ mSensorEventListener.reset();
mSensorManager.registerListener(mSensorEventListener, mSensor, mRate);
mEnabled = true;
}
diff --git a/core/java/android/view/animation/package.html b/core/java/android/view/animation/package.html
index 87c99bb..87c99bb 100755..100644
--- a/core/java/android/view/animation/package.html
+++ b/core/java/android/view/animation/package.html
diff --git a/core/java/android/webkit/BrowserFrame.java b/core/java/android/webkit/BrowserFrame.java
index 35aabf7..f0cc39b 100644
--- a/core/java/android/webkit/BrowserFrame.java
+++ b/core/java/android/webkit/BrowserFrame.java
@@ -56,8 +56,8 @@ import java.util.Map;
import java.util.Set;
import org.apache.harmony.security.provider.cert.X509CertImpl;
-import org.apache.harmony.xnet.provider.jsse.OpenSSLDSAPrivateKey;
-import org.apache.harmony.xnet.provider.jsse.OpenSSLRSAPrivateKey;
+import org.apache.harmony.xnet.provider.jsse.OpenSSLKey;
+import org.apache.harmony.xnet.provider.jsse.OpenSSLKeyHolder;
class BrowserFrame extends Handler {
@@ -1135,13 +1135,10 @@ class BrowserFrame extends Handler {
if (table.IsAllowed(hostAndPort)) {
// previously allowed
PrivateKey pkey = table.PrivateKey(hostAndPort);
- if (pkey instanceof OpenSSLRSAPrivateKey) {
+ if (pkey instanceof OpenSSLKeyHolder) {
+ OpenSSLKey sslKey = ((OpenSSLKeyHolder) pkey).getOpenSSLKey();
nativeSslClientCert(handle,
- ((OpenSSLRSAPrivateKey)pkey).getPkeyContext(),
- table.CertificateChain(hostAndPort));
- } else if (pkey instanceof OpenSSLDSAPrivateKey) {
- nativeSslClientCert(handle,
- ((OpenSSLDSAPrivateKey)pkey).getPkeyContext(),
+ sslKey.getPkeyContext(),
table.CertificateChain(hostAndPort));
} else {
nativeSslClientCert(handle,
@@ -1333,7 +1330,7 @@ class BrowserFrame extends Handler {
private native void nativeSslCertErrorCancel(int handle, int certError);
native void nativeSslClientCert(int handle,
- int ctx,
+ long ctx,
byte[][] asn1DerEncodedCertificateChain);
native void nativeSslClientCert(int handle,
diff --git a/core/java/android/webkit/ClientCertRequestHandler.java b/core/java/android/webkit/ClientCertRequestHandler.java
index 6570a9b8..f5a60f6 100644
--- a/core/java/android/webkit/ClientCertRequestHandler.java
+++ b/core/java/android/webkit/ClientCertRequestHandler.java
@@ -21,8 +21,8 @@ import java.security.PrivateKey;
import java.security.cert.CertificateEncodingException;
import java.security.cert.X509Certificate;
import org.apache.harmony.xnet.provider.jsse.NativeCrypto;
-import org.apache.harmony.xnet.provider.jsse.OpenSSLDSAPrivateKey;
-import org.apache.harmony.xnet.provider.jsse.OpenSSLRSAPrivateKey;
+import org.apache.harmony.xnet.provider.jsse.OpenSSLKey;
+import org.apache.harmony.xnet.provider.jsse.OpenSSLKeyHolder;
/**
* ClientCertRequestHandler: class responsible for handling client
@@ -56,14 +56,11 @@ public final class ClientCertRequestHandler extends Handler {
byte[][] chainBytes = NativeCrypto.encodeCertificates(chain);
mTable.Allow(mHostAndPort, privateKey, chainBytes);
- if (privateKey instanceof OpenSSLRSAPrivateKey) {
- setSslClientCertFromCtx(((OpenSSLRSAPrivateKey)privateKey).getPkeyContext(),
- chainBytes);
- } else if (privateKey instanceof OpenSSLDSAPrivateKey) {
- setSslClientCertFromCtx(((OpenSSLDSAPrivateKey)privateKey).getPkeyContext(),
- chainBytes);
+ if (privateKey instanceof OpenSSLKeyHolder) {
+ OpenSSLKey pkey = ((OpenSSLKeyHolder) privateKey).getOpenSSLKey();
+ setSslClientCertFromCtx(pkey.getPkeyContext(), chainBytes);
} else {
- setSslClientCertFromPKCS8(privateKey.getEncoded(),chainBytes);
+ setSslClientCertFromPKCS8(privateKey.getEncoded(), chainBytes);
}
} catch (CertificateEncodingException e) {
post(new Runnable() {
@@ -78,7 +75,7 @@ public final class ClientCertRequestHandler extends Handler {
/**
* Proceed with the specified private key bytes and client certificate chain.
*/
- private void setSslClientCertFromCtx(final int ctx, final byte[][] chainBytes) {
+ private void setSslClientCertFromCtx(final long ctx, final byte[][] chainBytes) {
post(new Runnable() {
public void run() {
mBrowserFrame.nativeSslClientCert(mHandle, ctx, chainBytes);
diff --git a/core/java/android/webkit/DeviceMotionService.java b/core/java/android/webkit/DeviceMotionService.java
index 9121429..9121429 100755..100644
--- a/core/java/android/webkit/DeviceMotionService.java
+++ b/core/java/android/webkit/DeviceMotionService.java
diff --git a/core/java/android/webkit/DeviceOrientationService.java b/core/java/android/webkit/DeviceOrientationService.java
index a4d240d..a4d240d 100755..100644
--- a/core/java/android/webkit/DeviceOrientationService.java
+++ b/core/java/android/webkit/DeviceOrientationService.java
diff --git a/core/java/android/webkit/FindActionModeCallback.java b/core/java/android/webkit/FindActionModeCallback.java
index 1a4ccfa..6a627e1 100644
--- a/core/java/android/webkit/FindActionModeCallback.java
+++ b/core/java/android/webkit/FindActionModeCallback.java
@@ -152,7 +152,7 @@ class FindActionModeCallback implements ActionMode.Callback, TextWatcher,
mActiveMatchIndex = matchIndex;
updateMatchesString();
} else {
- mMatches.setVisibility(View.INVISIBLE);
+ mMatches.setVisibility(View.GONE);
mNumberOfMatches = 0;
}
}
diff --git a/core/java/android/webkit/GeolocationPermissions.java b/core/java/android/webkit/GeolocationPermissions.java
index 9c0f754..9c0f754 100755..100644
--- a/core/java/android/webkit/GeolocationPermissions.java
+++ b/core/java/android/webkit/GeolocationPermissions.java
diff --git a/core/java/android/webkit/GeolocationPermissionsClassic.java b/core/java/android/webkit/GeolocationPermissionsClassic.java
index 8a9df39..8a9df39 100755..100644
--- a/core/java/android/webkit/GeolocationPermissionsClassic.java
+++ b/core/java/android/webkit/GeolocationPermissionsClassic.java
diff --git a/core/java/android/webkit/GeolocationService.java b/core/java/android/webkit/GeolocationService.java
index 225053b..225053b 100755..100644
--- a/core/java/android/webkit/GeolocationService.java
+++ b/core/java/android/webkit/GeolocationService.java
diff --git a/core/java/android/webkit/HTML5Audio.java b/core/java/android/webkit/HTML5Audio.java
index fc5df2d..684ec07 100644
--- a/core/java/android/webkit/HTML5Audio.java
+++ b/core/java/android/webkit/HTML5Audio.java
@@ -54,14 +54,15 @@ class HTML5Audio extends Handler
// The private status of the view that created this player
private IsPrivateBrowsingEnabledGetter mIsPrivateBrowsingEnabledGetter;
- private static int IDLE = 0;
- private static int INITIALIZED = 1;
- private static int PREPARED = 2;
- private static int STARTED = 4;
- private static int COMPLETE = 5;
- private static int PAUSED = 6;
- private static int STOPPED = -2;
- private static int ERROR = -1;
+ private static int IDLE = 0;
+ private static int INITIALIZED = 1;
+ private static int PREPARED = 2;
+ private static int STARTED = 4;
+ private static int COMPLETE = 5;
+ private static int PAUSED = 6;
+ private static int PAUSED_TRANSITORILY = 7;
+ private static int STOPPED = -2;
+ private static int ERROR = -1;
private int mState = IDLE;
@@ -247,7 +248,7 @@ class HTML5Audio extends Handler
// resume playback
if (mMediaPlayer == null) {
resetMediaPlayer();
- } else if (mState != ERROR && !mMediaPlayer.isPlaying()) {
+ } else if (mState == PAUSED_TRANSITORILY && !mMediaPlayer.isPlaying()) {
mMediaPlayer.start();
mState = STARTED;
}
@@ -265,7 +266,9 @@ class HTML5Audio extends Handler
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK:
// Lost focus for a short time, but we have to stop
// playback.
- if (mState != ERROR && mMediaPlayer.isPlaying()) pause();
+ if (mState != ERROR && mMediaPlayer.isPlaying()) {
+ pause(PAUSED_TRANSITORILY);
+ }
break;
}
}
@@ -298,12 +301,16 @@ class HTML5Audio extends Handler
}
private void pause() {
+ pause(PAUSED);
+ }
+
+ private void pause(int state) {
if (mState == STARTED) {
if (mTimer != null) {
mTimer.purge();
}
mMediaPlayer.pause();
- mState = PAUSED;
+ mState = state;
}
}
diff --git a/core/java/android/webkit/WebCoreThreadWatchdog.java b/core/java/android/webkit/WebCoreThreadWatchdog.java
index a22e6e8..c27bb5f 100644
--- a/core/java/android/webkit/WebCoreThreadWatchdog.java
+++ b/core/java/android/webkit/WebCoreThreadWatchdog.java
@@ -270,7 +270,7 @@ class WebCoreThreadWatchdog implements Runnable {
SUBSEQUENT_TIMEOUT_PERIOD);
}
})
- .setIcon(android.R.drawable.ic_dialog_alert)
+ .setIconAttribute(android.R.attr.alertDialogIcon)
.show();
}
}
diff --git a/core/java/android/webkit/WebViewClassic.java b/core/java/android/webkit/WebViewClassic.java
index ae56e6b..4db9f6c 100644
--- a/core/java/android/webkit/WebViewClassic.java
+++ b/core/java/android/webkit/WebViewClassic.java
@@ -1258,6 +1258,40 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
mAutoFillData = new WebViewCore.AutoFillData();
mEditTextScroller = new Scroller(context);
+
+ // Calculate channel distance
+ calculateChannelDistance(context);
+ }
+
+ /**
+ * Calculate sChannelDistance based on the screen information.
+ * @param context A Context object used to access application assets.
+ */
+ private void calculateChannelDistance(Context context) {
+ // The channel distance is adjusted for density and screen size
+ final DisplayMetrics metrics = context.getResources().getDisplayMetrics();
+ final double screenSize = Math.hypot((double)(metrics.widthPixels/metrics.densityDpi),
+ (double)(metrics.heightPixels/metrics.densityDpi));
+ if (screenSize < 3.0) {
+ sChannelDistance = 16;
+ } else if (screenSize < 5.0) {
+ sChannelDistance = 22;
+ } else if (screenSize < 7.0) {
+ sChannelDistance = 28;
+ } else {
+ sChannelDistance = 34;
+ }
+ sChannelDistance = (int)(sChannelDistance * metrics.density);
+ if (sChannelDistance < 16) sChannelDistance = 16;
+
+ if (DebugFlags.WEB_VIEW) {
+ Log.v(LOGTAG, "sChannelDistance : " + sChannelDistance
+ + ", density : " + metrics.density
+ + ", screenSize : " + screenSize
+ + ", metrics.heightPixels : " + metrics.heightPixels
+ + ", metrics.widthPixels : " + metrics.widthPixels
+ + ", metrics.densityDpi : " + metrics.densityDpi);
+ }
}
// WebViewProvider bindings
@@ -5382,7 +5416,7 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
ClipData clipData = cm.getPrimaryClip();
if (clipData != null) {
ClipData.Item clipItem = clipData.getItemAt(0);
- CharSequence pasteText = clipItem.getText();
+ CharSequence pasteText = clipItem.coerceToText(mContext);
if (mInputConnection != null) {
mInputConnection.replaceSelection(pasteText);
}
@@ -5715,32 +5749,13 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
}
return mWebViewPrivate.super_dispatchKeyEvent(event);
}
-
- /*
- * Here is the snap align logic:
- * 1. If it starts nearly horizontally or vertically, snap align;
- * 2. If there is a dramitic direction change, let it go;
- *
- * Adjustable parameters. Angle is the radians on a unit circle, limited
- * to quadrant 1. Values range from 0f (horizontal) to PI/2 (vertical)
- */
- private static final float HSLOPE_TO_START_SNAP = .25f;
- private static final float HSLOPE_TO_BREAK_SNAP = .4f;
- private static final float VSLOPE_TO_START_SNAP = 1.25f;
- private static final float VSLOPE_TO_BREAK_SNAP = .95f;
- /*
- * These values are used to influence the average angle when entering
- * snap mode. If is is the first movement entering snap, we set the average
- * to the appropriate ideal. If the user is entering into snap after the
- * first movement, then we average the average angle with these values.
- */
- private static final float ANGLE_VERT = 2f;
- private static final float ANGLE_HORIZ = 0f;
- /*
- * The modified moving average weight.
- * Formula: MAV[t]=MAV[t-1] + (P[t]-MAV[t-1])/n
- */
- private static final float MMA_WEIGHT_N = 5;
+
+ private static final int SNAP_BOUND = 16;
+ private static int sChannelDistance = 16;
+ private int mFirstTouchX = -1; // the first touched point
+ private int mFirstTouchY = -1;
+ private int mDistanceX = 0;
+ private int mDistanceY = 0;
private boolean inFullScreenMode() {
return mFullScreenHolder != null;
@@ -5830,12 +5845,6 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
}
}
- private float calculateDragAngle(int dx, int dy) {
- dx = Math.abs(dx);
- dy = Math.abs(dy);
- return (float) Math.atan2(dy, dx);
- }
-
/*
* Common code for single touch and multi-touch.
* (x, y) denotes current focus point, which is the touch point for single touch
@@ -5861,6 +5870,12 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
switch (action) {
case MotionEvent.ACTION_DOWN: {
mConfirmMove = false;
+
+ // Channel Scrolling
+ mFirstTouchX = x;
+ mFirstTouchY = y;
+ mDistanceX = mDistanceY = 0;
+
if (!mEditTextScroller.isFinished()) {
mEditTextScroller.abortAnimation();
}
@@ -5998,20 +6013,16 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
break;
}
- // Only lock dragging to one axis if we don't have a scale in progress.
- // Scaling implies free-roaming movement. Note this is only ever a question
- // if mZoomManager.supportsPanDuringZoom() is true.
- mAverageAngle = calculateDragAngle(deltaX, deltaY);
- if (detector == null || !detector.isInProgress()) {
- // if it starts nearly horizontal or vertical, enforce it
- if (mAverageAngle < HSLOPE_TO_START_SNAP) {
- mSnapScrollMode = SNAP_X;
- mSnapPositive = deltaX > 0;
- mAverageAngle = ANGLE_HORIZ;
- } else if (mAverageAngle > VSLOPE_TO_START_SNAP) {
+ if ((detector == null || !detector.isInProgress())
+ && SNAP_NONE == mSnapScrollMode) {
+ int ax = Math.abs(x - mFirstTouchX);
+ int ay = Math.abs(y - mFirstTouchY);
+ if (ax < SNAP_BOUND && ay < SNAP_BOUND) {
+ break;
+ } else if (ax < SNAP_BOUND) {
mSnapScrollMode = SNAP_Y;
- mSnapPositive = deltaY > 0;
- mAverageAngle = ANGLE_VERT;
+ } else if (ay < SNAP_BOUND) {
+ mSnapScrollMode = SNAP_X;
}
}
@@ -6030,31 +6041,21 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
if (deltaX == 0 && deltaY == 0) {
keepScrollBarsVisible = true;
} else {
- mAverageAngle +=
- (calculateDragAngle(deltaX, deltaY) - mAverageAngle)
- / MMA_WEIGHT_N;
- if (mSnapScrollMode != SNAP_NONE) {
- if (mSnapScrollMode == SNAP_Y) {
- // radical change means getting out of snap mode
- if (mAverageAngle < VSLOPE_TO_BREAK_SNAP) {
- mSnapScrollMode = SNAP_NONE;
- }
- }
+ if (mSnapScrollMode == SNAP_X || mSnapScrollMode == SNAP_Y) {
+ mDistanceX += Math.abs(deltaX);
+ mDistanceY += Math.abs(deltaY);
if (mSnapScrollMode == SNAP_X) {
- // radical change means getting out of snap mode
- if (mAverageAngle > HSLOPE_TO_BREAK_SNAP) {
+ if (mDistanceY > sChannelDistance) {
mSnapScrollMode = SNAP_NONE;
- }
+ } else if (mDistanceX > sChannelDistance) {
+ mDistanceX = mDistanceY = 0;
}
} else {
- if (mAverageAngle < HSLOPE_TO_START_SNAP) {
- mSnapScrollMode = SNAP_X;
- mSnapPositive = deltaX > 0;
- mAverageAngle = (mAverageAngle + ANGLE_HORIZ) / 2;
- } else if (mAverageAngle > VSLOPE_TO_START_SNAP) {
- mSnapScrollMode = SNAP_Y;
- mSnapPositive = deltaY > 0;
- mAverageAngle = (mAverageAngle + ANGLE_VERT) / 2;
+ if (mDistanceX > sChannelDistance) {
+ mSnapScrollMode = SNAP_NONE;
+ } else if (mDistanceY > sChannelDistance) {
+ mDistanceX = mDistanceY = 0;
+ }
}
}
if (mSnapScrollMode != SNAP_NONE) {
@@ -6089,6 +6090,7 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
break;
}
case MotionEvent.ACTION_UP: {
+ mFirstTouchX = mFirstTouchY = -1;
if (mIsEditingText && mSelectionStarted) {
endScrollEdit();
mPrivateHandler.sendEmptyMessageDelayed(SCROLL_HANDLE_INTO_VIEW,
@@ -8366,8 +8368,10 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
mListBoxDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
+ if (mWebViewCore != null) {
mWebViewCore.sendMessage(
EventHub.SINGLE_LISTBOX_CHOICE, -2, 0);
+ }
mListBoxDialog = null;
}
});
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index 3fb3ec6..c35b768 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -1278,6 +1278,7 @@ public final class WebViewCore {
mBrowserFrame = null;
mSettings.onDestroyed();
mNativeClass = 0;
+ WebCoreThreadWatchdog.unregisterWebView(mWebViewClassic);
mWebViewClassic = null;
}
break;
@@ -1982,7 +1983,6 @@ public final class WebViewCore {
mEventHub.sendMessageAtFrontOfQueue(
Message.obtain(null, EventHub.DESTROY));
mEventHub.blockMessages();
- WebCoreThreadWatchdog.unregisterWebView(mWebViewClassic);
}
}
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 33a8531..57bf0d3 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -2637,7 +2637,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
if (mTouchModeReset != null) {
removeCallbacks(mTouchModeReset);
- mTouchModeReset = null;
+ mTouchModeReset.run();
}
mIsAttached = false;
}
@@ -3416,6 +3416,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
mTouchModeReset = new Runnable() {
@Override
public void run() {
+ mTouchModeReset = null;
mTouchMode = TOUCH_MODE_REST;
child.setPressed(false);
setPressed(false);
diff --git a/core/java/android/widget/AppSecurityPermissions.java b/core/java/android/widget/AppSecurityPermissions.java
index 06dadb0..06dadb0 100755..100644
--- a/core/java/android/widget/AppSecurityPermissions.java
+++ b/core/java/android/widget/AppSecurityPermissions.java
diff --git a/core/java/android/widget/CheckBox.java b/core/java/android/widget/CheckBox.java
index 41ab5f2..f1804f8 100644
--- a/core/java/android/widget/CheckBox.java
+++ b/core/java/android/widget/CheckBox.java
@@ -20,7 +20,6 @@ import android.content.Context;
import android.util.AttributeSet;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
-import android.util.ValueModel;
/**
@@ -56,9 +55,7 @@ import android.util.ValueModel;
* {@link android.R.styleable#View View Attributes}
* </p>
*/
-public class CheckBox extends CompoundButton implements ValueEditor<Boolean> {
- private ValueModel<Boolean> mValueModel = ValueModel.EMPTY;
-
+public class CheckBox extends CompoundButton {
public CheckBox(Context context) {
this(context, null);
}
@@ -82,22 +79,4 @@ public class CheckBox extends CompoundButton implements ValueEditor<Boolean> {
super.onInitializeAccessibilityNodeInfo(info);
info.setClassName(CheckBox.class.getName());
}
-
- @Override
- public ValueModel<Boolean> getValueModel() {
- return mValueModel;
- }
-
- @Override
- public void setValueModel(ValueModel<Boolean> valueModel) {
- mValueModel = valueModel;
- setChecked(mValueModel.get());
- }
-
- @Override
- public boolean performClick() {
- boolean handled = super.performClick();
- mValueModel.set(isChecked());
- return handled;
- }
}
diff --git a/core/java/android/widget/DateTimeView.java b/core/java/android/widget/DateTimeView.java
index 6e6e4af..af6bbcb 100644
--- a/core/java/android/widget/DateTimeView.java
+++ b/core/java/android/widget/DateTimeView.java
@@ -189,15 +189,7 @@ public class DateTimeView extends TextView {
}
private DateFormat getTimeFormat() {
- int res;
- Context context = getContext();
- if (android.text.format.DateFormat.is24HourFormat(context)) {
- res = R.string.twenty_four_hour_time_format;
- } else {
- res = R.string.twelve_hour_time_format;
- }
- String format = context.getString(res);
- return new SimpleDateFormat(format);
+ return android.text.format.DateFormat.getTimeFormat(getContext());
}
private DateFormat getDateFormat() {
diff --git a/core/java/android/widget/DigitalClock.java b/core/java/android/widget/DigitalClock.java
index c6b6dd6..b6c1e5b 100644
--- a/core/java/android/widget/DigitalClock.java
+++ b/core/java/android/widget/DigitalClock.java
@@ -39,8 +39,6 @@ public class DigitalClock extends TextView {
// proportional fonts don't shake rendering
Calendar mCalendar;
- private final static String m12 = "h:mm:ss aa";
- private final static String m24 = "k:mm:ss";
@SuppressWarnings("FieldCanBeLocal") // We must keep a reference to this observer
private FormatChangeObserver mFormatChangeObserver;
@@ -102,19 +100,8 @@ public class DigitalClock extends TextView {
mTickerStopped = true;
}
- /**
- * Pulls 12/24 mode from system settings
- */
- private boolean get24HourMode() {
- return android.text.format.DateFormat.is24HourFormat(getContext());
- }
-
private void setFormat() {
- if (get24HourMode()) {
- mFormat = m24;
- } else {
- mFormat = m12;
- }
+ mFormat = DateFormat.getTimeFormatString(getContext());
}
private class FormatChangeObserver extends ContentObserver {
diff --git a/core/java/android/widget/EditText.java b/core/java/android/widget/EditText.java
index ec81214..57e51c2 100644
--- a/core/java/android/widget/EditText.java
+++ b/core/java/android/widget/EditText.java
@@ -17,7 +17,6 @@
package android.widget;
import android.content.Context;
-import android.graphics.Rect;
import android.text.Editable;
import android.text.Selection;
import android.text.Spannable;
@@ -25,7 +24,6 @@ import android.text.TextUtils;
import android.text.method.ArrowKeyMovementMethod;
import android.text.method.MovementMethod;
import android.util.AttributeSet;
-import android.util.ValueModel;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
@@ -49,9 +47,7 @@ import android.view.accessibility.AccessibilityNodeInfo;
* {@link android.R.styleable#TextView TextView Attributes},
* {@link android.R.styleable#View View Attributes}
*/
-public class EditText extends TextView implements ValueEditor<CharSequence> {
- private ValueModel<CharSequence> mValueModel = ValueModel.EMPTY;
-
+public class EditText extends TextView {
public EditText(Context context) {
this(context, null);
}
@@ -132,21 +128,4 @@ public class EditText extends TextView implements ValueEditor<CharSequence> {
super.onInitializeAccessibilityNodeInfo(info);
info.setClassName(EditText.class.getName());
}
-
- @Override
- public ValueModel<CharSequence> getValueModel() {
- return mValueModel;
- }
-
- @Override
- public void setValueModel(ValueModel<CharSequence> valueModel) {
- mValueModel = valueModel;
- setText(mValueModel.get());
- }
-
- @Override
- void sendAfterTextChanged(Editable text) {
- super.sendAfterTextChanged(text);
- mValueModel.set(text);
- }
}
diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java
index 30d022c..8892316 100644
--- a/core/java/android/widget/Editor.java
+++ b/core/java/android/widget/Editor.java
@@ -2696,23 +2696,14 @@ public class Editor {
TypedArray styledAttributes = mTextView.getContext().obtainStyledAttributes(
com.android.internal.R.styleable.SelectionModeDrawables);
- boolean allowText = mTextView.getContext().getResources().getBoolean(
- com.android.internal.R.bool.config_allowActionMenuItemTextWithIcon);
-
mode.setTitle(mTextView.getContext().getString(
com.android.internal.R.string.textSelectionCABTitle));
mode.setSubtitle(null);
mode.setTitleOptionalHint(true);
- int selectAllIconId = 0; // No icon by default
- if (!allowText) {
- // Provide an icon, text will not be displayed on smaller screens.
- selectAllIconId = styledAttributes.getResourceId(
- R.styleable.SelectionModeDrawables_actionModeSelectAllDrawable, 0);
- }
-
menu.add(0, TextView.ID_SELECT_ALL, 0, com.android.internal.R.string.selectAll).
- setIcon(selectAllIconId).
+ setIcon(styledAttributes.getResourceId(
+ R.styleable.SelectionModeDrawables_actionModeSelectAllDrawable, 0)).
setAlphabeticShortcut('a').
setShowAsAction(
MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
diff --git a/core/java/android/widget/HeaderViewListAdapter.java b/core/java/android/widget/HeaderViewListAdapter.java
index e2a269e..0685e61 100644
--- a/core/java/android/widget/HeaderViewListAdapter.java
+++ b/core/java/android/widget/HeaderViewListAdapter.java
@@ -79,7 +79,8 @@ public class HeaderViewListAdapter implements WrapperListAdapter, Filterable {
}
public boolean isEmpty() {
- return mAdapter == null || mAdapter.isEmpty();
+ return (mAdapter == null || mAdapter.isEmpty())
+ && getFootersCount() + getHeadersCount() == 0;
}
private boolean areAllListInfosSelectable(ArrayList<ListView.FixedViewInfo> infos) {
diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java
index 03507b5..4436fbb 100644
--- a/core/java/android/widget/ListView.java
+++ b/core/java/android/widget/ListView.java
@@ -2429,7 +2429,9 @@ public class ListView extends AbsListView {
View selectedView = getSelectedView();
int selectedPos = mSelectedPosition;
- int nextSelectedPosition = lookForSelectablePositionOnScreen(direction);
+ int nextSelectedPosition = (direction == View.FOCUS_DOWN) ?
+ lookForSelectablePosition(selectedPos + 1, true) :
+ lookForSelectablePosition(selectedPos - 1, false);
int amountToScroll = amountToScroll(direction, nextSelectedPosition);
// if we are moving focus, we may OVERRIDE the default behavior
@@ -2641,14 +2643,18 @@ public class ListView extends AbsListView {
final int listBottom = getHeight() - mListPadding.bottom;
final int listTop = mListPadding.top;
- final int numChildren = getChildCount();
+ int numChildren = getChildCount();
if (direction == View.FOCUS_DOWN) {
int indexToMakeVisible = numChildren - 1;
if (nextSelectedPosition != INVALID_POSITION) {
indexToMakeVisible = nextSelectedPosition - mFirstPosition;
}
-
+ while (numChildren <= indexToMakeVisible) {
+ // Child to view is not attached yet.
+ addViewBelow(getChildAt(numChildren - 1), mFirstPosition + numChildren - 1);
+ numChildren++;
+ }
final int positionToMakeVisible = mFirstPosition + indexToMakeVisible;
final View viewToMakeVisible = getChildAt(indexToMakeVisible);
@@ -2682,6 +2688,12 @@ public class ListView extends AbsListView {
if (nextSelectedPosition != INVALID_POSITION) {
indexToMakeVisible = nextSelectedPosition - mFirstPosition;
}
+ while (indexToMakeVisible < 0) {
+ // Child to view is not attached yet.
+ addViewAbove(getChildAt(0), mFirstPosition);
+ mFirstPosition--;
+ indexToMakeVisible = nextSelectedPosition - mFirstPosition;
+ }
final int positionToMakeVisible = mFirstPosition + indexToMakeVisible;
final View viewToMakeVisible = getChildAt(indexToMakeVisible);
int goalTop = listTop;
@@ -2981,11 +2993,9 @@ public class ListView extends AbsListView {
while (first.getBottom() < listTop) {
AbsListView.LayoutParams layoutParams = (LayoutParams) first.getLayoutParams();
if (recycleBin.shouldRecycleViewType(layoutParams.viewType)) {
- detachViewFromParent(first);
recycleBin.addScrapView(first, mFirstPosition);
- } else {
- removeViewInLayout(first);
}
+ detachViewFromParent(first);
first = getChildAt(0);
mFirstPosition++;
}
@@ -3012,11 +3022,9 @@ public class ListView extends AbsListView {
while (last.getTop() > listBottom) {
AbsListView.LayoutParams layoutParams = (LayoutParams) last.getLayoutParams();
if (recycleBin.shouldRecycleViewType(layoutParams.viewType)) {
- detachViewFromParent(last);
recycleBin.addScrapView(last, mFirstPosition+lastIndex);
- } else {
- removeViewInLayout(last);
}
+ detachViewFromParent(last);
last = getChildAt(--lastIndex);
}
}
diff --git a/core/java/android/widget/NumberPicker.java b/core/java/android/widget/NumberPicker.java
index 74ded18..2ac5a12 100644
--- a/core/java/android/widget/NumberPicker.java
+++ b/core/java/android/widget/NumberPicker.java
@@ -1969,8 +1969,10 @@ public class NumberPicker extends LinearLayout {
* Ensure the user can't type in a value greater than the max
* allowed. We have to allow less than min as the user might
* want to delete some numbers and then type a new number.
+ * And prevent multiple-"0" that exceeds the length of upper
+ * bound number.
*/
- if (val > mMaxValue) {
+ if (val > mMaxValue || result.length() > String.valueOf(mMaxValue).length()) {
return "";
} else {
return filtered;
diff --git a/core/java/android/widget/SeekBar.java b/core/java/android/widget/SeekBar.java
index a6486a8..2737f94 100644
--- a/core/java/android/widget/SeekBar.java
+++ b/core/java/android/widget/SeekBar.java
@@ -18,7 +18,6 @@ package android.widget;
import android.content.Context;
import android.util.AttributeSet;
-import android.util.ValueModel;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
@@ -34,7 +33,7 @@ import android.view.accessibility.AccessibilityNodeInfo;
*
* @attr ref android.R.styleable#SeekBar_thumb
*/
-public class SeekBar extends AbsSeekBar implements ValueEditor<Integer> {
+public class SeekBar extends AbsSeekBar {
/**
* A callback that notifies clients when the progress level has been
@@ -70,9 +69,8 @@ public class SeekBar extends AbsSeekBar implements ValueEditor<Integer> {
void onStopTrackingTouch(SeekBar seekBar);
}
- private ValueModel<Integer> mValueModel = ValueModel.EMPTY;
private OnSeekBarChangeListener mOnSeekBarChangeListener;
-
+
public SeekBar(Context context) {
this(context, null);
}
@@ -91,23 +89,9 @@ public class SeekBar extends AbsSeekBar implements ValueEditor<Integer> {
if (mOnSeekBarChangeListener != null) {
mOnSeekBarChangeListener.onProgressChanged(this, getProgress(), fromUser);
- if (fromUser) {
- mValueModel.set(getProgress());
- }
}
}
- @Override
- public ValueModel<Integer> getValueModel() {
- return mValueModel;
- }
-
- @Override
- public void setValueModel(ValueModel<Integer> valueModel) {
- mValueModel = valueModel;
- setProgress(mValueModel.get());
- }
-
/**
* Sets a listener to receive notifications of changes to the SeekBar's progress level. Also
* provides notifications of when the user starts and stops a touch gesture within the SeekBar.
diff --git a/core/java/android/widget/TextClock.java b/core/java/android/widget/TextClock.java
index 290d9b5..2f08253 100644
--- a/core/java/android/widget/TextClock.java
+++ b/core/java/android/widget/TextClock.java
@@ -36,21 +36,24 @@ import com.android.internal.R;
import java.util.Calendar;
import java.util.TimeZone;
+import libcore.icu.LocaleData;
+
import static android.view.ViewDebug.ExportedProperty;
import static android.widget.RemoteViews.*;
/**
* <p><code>TextClock</code> can display the current date and/or time as
* a formatted string.</p>
- *
+ *
* <p>This view honors the 24-hour format system setting. As such, it is
* possible and recommended to provide two different formatting patterns:
* one to display the date/time in 24-hour mode and one to display the
- * date/time in 12-hour mode.</p>
- *
+ * date/time in 12-hour mode. Most callers will want to use the defaults,
+ * though, which will be appropriate for the user's locale.</p>
+ *
* <p>It is possible to determine whether the system is currently in
* 24-hour mode by calling {@link #is24HourModeEnabled()}.</p>
- *
+ *
* <p>The rules used by this widget to decide how to format the date and
* time are the following:</p>
* <ul>
@@ -58,22 +61,24 @@ import static android.widget.RemoteViews.*;
* <ul>
* <li>Use the value returned by {@link #getFormat24Hour()} when non-null</li>
* <li>Otherwise, use the value returned by {@link #getFormat12Hour()} when non-null</li>
- * <li>Otherwise, use {@link #DEFAULT_FORMAT_24_HOUR}</li>
+ * <li>Otherwise, use a default value appropriate for the user's locale, such as {@code h:mm a}</li>
* </ul>
* </li>
* <li>In 12-hour mode:
* <ul>
* <li>Use the value returned by {@link #getFormat12Hour()} when non-null</li>
* <li>Otherwise, use the value returned by {@link #getFormat24Hour()} when non-null</li>
- * <li>Otherwise, use {@link #DEFAULT_FORMAT_12_HOUR}</li>
+ * <li>Otherwise, use a default value appropriate for the user's locale, such as {@code HH:mm}</li>
* </ul>
* </li>
* </ul>
- *
+ *
* <p>The {@link CharSequence} instances used as formatting patterns when calling either
* {@link #setFormat24Hour(CharSequence)} or {@link #setFormat12Hour(CharSequence)} can
- * contain styling information. To do so, use a {@link android.text.Spanned} object.</p>
- *
+ * contain styling information. To do so, use a {@link android.text.Spanned} object.
+ * Note that if you customize these strings, it is your responsibility to supply strings
+ * appropriate for formatting dates and/or times in the user's locale.</p>
+ *
* @attr ref android.R.styleable#TextClock_format12Hour
* @attr ref android.R.styleable#TextClock_format24Hour
* @attr ref android.R.styleable#TextClock_timeZone
@@ -81,32 +86,34 @@ import static android.widget.RemoteViews.*;
@RemoteView
public class TextClock extends TextView {
/**
- * The default formatting pattern in 12-hour mode. This pattenr is used
+ * The default formatting pattern in 12-hour mode. This pattern is used
* if {@link #setFormat12Hour(CharSequence)} is called with a null pattern
* or if no pattern was specified when creating an instance of this class.
- *
+ *
* This default pattern shows only the time, hours and minutes, and an am/pm
* indicator.
*
* @see #setFormat12Hour(CharSequence)
* @see #getFormat12Hour()
+ * @deprecated Let the system use locale-appropriate defaults instead.
*/
- public static final CharSequence DEFAULT_FORMAT_12_HOUR = "h:mm aa";
+ public static final CharSequence DEFAULT_FORMAT_12_HOUR = "h:mm a";
/**
- * The default formatting pattern in 24-hour mode. This pattenr is used
+ * The default formatting pattern in 24-hour mode. This pattern is used
* if {@link #setFormat24Hour(CharSequence)} is called with a null pattern
* or if no pattern was specified when creating an instance of this class.
*
* This default pattern shows only the time, hours and minutes.
- *
- * @see #setFormat24Hour(CharSequence)
- * @see #getFormat24Hour()
+ *
+ * @see #setFormat24Hour(CharSequence)
+ * @see #getFormat24Hour()
+ * @deprecated Let the system use locale-appropriate defaults instead.
*/
- public static final CharSequence DEFAULT_FORMAT_24_HOUR = "k:mm";
+ public static final CharSequence DEFAULT_FORMAT_24_HOUR = "H:mm";
- private CharSequence mFormat12 = DEFAULT_FORMAT_12_HOUR;
- private CharSequence mFormat24 = DEFAULT_FORMAT_24_HOUR;
+ private CharSequence mFormat12;
+ private CharSequence mFormat24;
@ExportedProperty
private CharSequence mFormat;
@@ -158,7 +165,7 @@ public class TextClock extends TextView {
* Creates a new clock using the default patterns
* {@link #DEFAULT_FORMAT_24_HOUR} and {@link #DEFAULT_FORMAT_12_HOUR}
* respectively for the 24-hour and 12-hour modes.
- *
+ *
* @param context The Context the view is running in, through which it can
* access the current theme, resources, etc.
*/
@@ -171,7 +178,7 @@ public class TextClock extends TextView {
/**
* Creates a new clock inflated from XML. This object's properties are
* intialized from the attributes specified in XML.
- *
+ *
* This constructor uses a default style of 0, so the only attribute values
* applied are those in the Context's Theme and the given AttributeSet.
*
@@ -201,14 +208,8 @@ public class TextClock extends TextView {
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TextClock, defStyle, 0);
try {
- CharSequence format;
-
- format = a.getText(R.styleable.TextClock_format12Hour);
- mFormat12 = format == null ? DEFAULT_FORMAT_12_HOUR : format;
-
- format = a.getText(R.styleable.TextClock_format24Hour);
- mFormat24 = format == null ? DEFAULT_FORMAT_24_HOUR : format;
-
+ mFormat12 = a.getText(R.styleable.TextClock_format12Hour);
+ mFormat24 = a.getText(R.styleable.TextClock_format24Hour);
mTimeZone = a.getString(R.styleable.TextClock_timeZone);
} finally {
a.recycle();
@@ -218,6 +219,16 @@ public class TextClock extends TextView {
}
private void init() {
+ if (mFormat12 == null || mFormat24 == null) {
+ LocaleData ld = LocaleData.get(getContext().getResources().getConfiguration().locale);
+ if (mFormat12 == null) {
+ mFormat12 = ld.timeFormat12;
+ }
+ if (mFormat24 == null) {
+ mFormat24 = ld.timeFormat24;
+ }
+ }
+
createTime(mTimeZone);
// Wait until onAttachedToWindow() to handle the ticker
chooseFormat(false);
@@ -235,11 +246,11 @@ public class TextClock extends TextView {
* Returns the formatting pattern used to display the date and/or time
* in 12-hour mode. The formatting pattern syntax is described in
* {@link DateFormat}.
- *
+ *
* @return A {@link CharSequence} or null.
- *
- * @see #setFormat12Hour(CharSequence)
- * @see #is24HourModeEnabled()
+ *
+ * @see #setFormat12Hour(CharSequence)
+ * @see #is24HourModeEnabled()
*/
@ExportedProperty
public CharSequence getFormat12Hour() {
@@ -257,12 +268,12 @@ public class TextClock extends TextView {
* {@link #DEFAULT_FORMAT_12_HOUR} will be used instead.
*
* @param format A date/time formatting pattern as described in {@link DateFormat}
- *
+ *
* @see #getFormat12Hour()
* @see #is24HourModeEnabled()
* @see #DEFAULT_FORMAT_12_HOUR
* @see DateFormat
- *
+ *
* @attr ref android.R.styleable#TextClock_format12Hour
*/
@RemotableViewMethod
@@ -292,7 +303,7 @@ public class TextClock extends TextView {
* Specifies the formatting pattern used to display the date and/or time
* in 24-hour mode. The formatting pattern syntax is described in
* {@link DateFormat}.
- *
+ *
* If this pattern is set to null, {@link #getFormat12Hour()} will be used
* even in 24-hour mode. If both 24-hour and 12-hour formatting patterns
* are set to null, {@link #DEFAULT_FORMAT_24_HOUR} and
@@ -301,7 +312,7 @@ public class TextClock extends TextView {
* @param format A date/time formatting pattern as described in {@link DateFormat}
*
* @see #getFormat24Hour()
- * @see #is24HourModeEnabled()
+ * @see #is24HourModeEnabled()
* @see #DEFAULT_FORMAT_24_HOUR
* @see DateFormat
*
@@ -317,22 +328,22 @@ public class TextClock extends TextView {
/**
* Indicates whether the system is currently using the 24-hour mode.
- *
+ *
* When the system is in 24-hour mode, this view will use the pattern
* returned by {@link #getFormat24Hour()}. In 12-hour mode, the pattern
* returned by {@link #getFormat12Hour()} is used instead.
- *
+ *
* If either one of the formats is null, the other format is used. If
* both formats are null, the default values {@link #DEFAULT_FORMAT_12_HOUR}
* and {@link #DEFAULT_FORMAT_24_HOUR} are used instead.
- *
+ *
* @return true if time should be displayed in 24-hour format, false if it
* should be displayed in 12-hour format.
- *
+ *
* @see #setFormat12Hour(CharSequence)
- * @see #getFormat12Hour()
+ * @see #getFormat12Hour()
* @see #setFormat24Hour(CharSequence)
- * @see #getFormat24Hour()
+ * @see #getFormat24Hour()
*/
public boolean is24HourModeEnabled() {
return DateFormat.is24HourFormat(getContext());
@@ -340,13 +351,13 @@ public class TextClock extends TextView {
/**
* Indicates which time zone is currently used by this view.
- *
+ *
* @return The ID of the current time zone or null if the default time zone,
* as set by the user, must be used
*
* @see TimeZone
* @see java.util.TimeZone#getAvailableIDs()
- * @see #setTimeZone(String)
+ * @see #setTimeZone(String)
*/
public String getTimeZone() {
return mTimeZone;
@@ -378,7 +389,7 @@ public class TextClock extends TextView {
/**
* Selects either one of {@link #getFormat12Hour()} or {@link #getFormat24Hour()}
* depending on whether the user has selected 24-hour format.
- *
+ *
* Calling this method does not schedule or unschedule the time ticker.
*/
private void chooseFormat() {
@@ -388,17 +399,19 @@ public class TextClock extends TextView {
/**
* Selects either one of {@link #getFormat12Hour()} or {@link #getFormat24Hour()}
* depending on whether the user has selected 24-hour format.
- *
+ *
* @param handleTicker true if calling this method should schedule/unschedule the
* time ticker, false otherwise
*/
private void chooseFormat(boolean handleTicker) {
final boolean format24Requested = is24HourModeEnabled();
+ LocaleData ld = LocaleData.get(getContext().getResources().getConfiguration().locale);
+
if (format24Requested) {
- mFormat = abc(mFormat24, mFormat12, DEFAULT_FORMAT_24_HOUR);
+ mFormat = abc(mFormat24, mFormat12, ld.timeFormat24);
} else {
- mFormat = abc(mFormat12, mFormat24, DEFAULT_FORMAT_12_HOUR);
+ mFormat = abc(mFormat12, mFormat24, ld.timeFormat12);
}
boolean hadSeconds = mHasSeconds;
diff --git a/core/java/android/widget/ValueEditor.java b/core/java/android/widget/ValueEditor.java
deleted file mode 100755
index 2b91abf..0000000
--- a/core/java/android/widget/ValueEditor.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.widget;
-
-import android.util.ValueModel;
-
-/**
- * An interface for editors of simple values. Classes implementing this interface are normally
- * UI controls (subclasses of {@link android.view.View View}) that can provide a suitable
- * user interface to display and edit values of the specified type. This interface is
- * intended to describe editors for simple types, like {@code boolean}, {@code int} or
- * {@code String}, where the values themselves are immutable.
- * <p>
- * For example, {@link android.widget.CheckBox CheckBox} implements
- * this interface for the Boolean type as it is capable of providing an appropriate
- * mechanism for displaying and changing the value of a Boolean property.
- *
- * @param <T> the value type that this editor supports
- */
-public interface ValueEditor<T> {
- /**
- * Return the last value model that was set. If no value model has been set, the editor
- * should return the value {@link android.util.ValueModel#EMPTY}.
- *
- * @return the value model
- */
- public ValueModel<T> getValueModel();
-
- /**
- * Sets the value model for this editor. When the value model is set, the editor should
- * retrieve the value from the value model, using {@link android.util.ValueModel#get()},
- * and set its internal state accordingly. Likewise, when the editor's internal state changes
- * it should update the value model by calling {@link android.util.ValueModel#set(T)}
- * with the appropriate value.
- *
- * @param valueModel the new value model for this editor.
- */
- public void setValueModel(ValueModel<T> valueModel);
-}
diff --git a/core/java/com/android/internal/app/IMediaContainerService.aidl b/core/java/com/android/internal/app/IMediaContainerService.aidl
index 03d3b22..03d3b22 100755..100644
--- a/core/java/com/android/internal/app/IMediaContainerService.aidl
+++ b/core/java/com/android/internal/app/IMediaContainerService.aidl
diff --git a/core/java/com/android/internal/app/IUsageStats.aidl b/core/java/com/android/internal/app/IUsageStats.aidl
index 1ea7409..1ea7409 100755..100644
--- a/core/java/com/android/internal/app/IUsageStats.aidl
+++ b/core/java/com/android/internal/app/IUsageStats.aidl
diff --git a/core/java/com/android/internal/app/NetInitiatedActivity.java b/core/java/com/android/internal/app/NetInitiatedActivity.java
index e1166f1..e1166f1 100755..100644
--- a/core/java/com/android/internal/app/NetInitiatedActivity.java
+++ b/core/java/com/android/internal/app/NetInitiatedActivity.java
diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java
index e63c57f..c22cd26 100644
--- a/core/java/com/android/internal/app/ResolverActivity.java
+++ b/core/java/com/android/internal/app/ResolverActivity.java
@@ -35,7 +35,6 @@ import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.PatternMatcher;
-import android.os.Process;
import android.os.RemoteException;
import android.os.UserHandle;
import android.util.Log;
@@ -64,6 +63,7 @@ import java.util.Set;
*/
public class ResolverActivity extends AlertActivity implements AdapterView.OnItemClickListener {
private static final String TAG = "ResolverActivity";
+ private static final boolean DEBUG = false;
private int mLaunchedFromUid;
private ResolveListAdapter mAdapter;
@@ -323,7 +323,7 @@ public class ResolverActivity extends AlertActivity implements AdapterView.OnIte
|| (!"file".equals(data.getScheme())
&& !"content".equals(data.getScheme()))) {
filter.addDataScheme(data.getScheme());
-
+
// Look through the resolved filter to determine which part
// of it matched the original Intent.
Iterator<IntentFilter.AuthorityEntry> aIt = ri.filter.authoritiesIterator();
@@ -402,7 +402,6 @@ public class ResolverActivity extends AlertActivity implements AdapterView.OnIte
private final int mLaunchedFromUid;
private final LayoutInflater mInflater;
- private List<ResolveInfo> mCurrentResolveList;
private List<DisplayResolveInfo> mList;
public ResolveListAdapter(Context context, Intent intent,
@@ -413,6 +412,7 @@ public class ResolverActivity extends AlertActivity implements AdapterView.OnIte
mBaseResolveList = rList;
mLaunchedFromUid = launchedFromUid;
mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ mList = new ArrayList<DisplayResolveInfo>();
rebuildList();
}
@@ -420,22 +420,23 @@ public class ResolverActivity extends AlertActivity implements AdapterView.OnIte
final int oldItemCount = getCount();
rebuildList();
notifyDataSetChanged();
- if (mList.size() <= 0) {
+ final int newItemCount = getCount();
+ if (newItemCount == 0) {
// We no longer have any items... just finish the activity.
finish();
- }
-
- final int newItemCount = getCount();
- if (newItemCount != oldItemCount) {
+ } else if (newItemCount != oldItemCount) {
resizeGrid();
}
}
private void rebuildList() {
+ List<ResolveInfo> currentResolveList;
+
+ mList.clear();
if (mBaseResolveList != null) {
- mCurrentResolveList = mBaseResolveList;
+ currentResolveList = mBaseResolveList;
} else {
- mCurrentResolveList = mPm.queryIntentActivities(
+ currentResolveList = mPm.queryIntentActivities(
mIntent, PackageManager.MATCH_DEFAULT_ONLY
| (mAlwaysUseOption ? PackageManager.GET_RESOLVED_FILTER : 0));
// Filter out any activities that the launched uid does not
@@ -443,36 +444,36 @@ public class ResolverActivity extends AlertActivity implements AdapterView.OnIte
// list of resolved activities, because that only happens when
// we are being subclassed, so we can safely launch whatever
// they gave us.
- if (mCurrentResolveList != null) {
- for (int i=mCurrentResolveList.size()-1; i >= 0; i--) {
- ActivityInfo ai = mCurrentResolveList.get(i).activityInfo;
+ if (currentResolveList != null) {
+ for (int i=currentResolveList.size()-1; i >= 0; i--) {
+ ActivityInfo ai = currentResolveList.get(i).activityInfo;
int granted = ActivityManager.checkComponentPermission(
ai.permission, mLaunchedFromUid,
ai.applicationInfo.uid, ai.exported);
if (granted != PackageManager.PERMISSION_GRANTED) {
// Access not allowed!
- mCurrentResolveList.remove(i);
+ currentResolveList.remove(i);
}
}
}
}
int N;
- if ((mCurrentResolveList != null) && ((N = mCurrentResolveList.size()) > 0)) {
+ if ((currentResolveList != null) && ((N = currentResolveList.size()) > 0)) {
// Only display the first matches that are either of equal
// priority or have asked to be default options.
- ResolveInfo r0 = mCurrentResolveList.get(0);
+ ResolveInfo r0 = currentResolveList.get(0);
for (int i=1; i<N; i++) {
- ResolveInfo ri = mCurrentResolveList.get(i);
- if (false) Log.v(
+ ResolveInfo ri = currentResolveList.get(i);
+ if (DEBUG) Log.v(
"ResolveListActivity",
r0.activityInfo.name + "=" +
r0.priority + "/" + r0.isDefault + " vs " +
ri.activityInfo.name + "=" +
ri.priority + "/" + ri.isDefault);
- if (r0.priority != ri.priority ||
+ if (r0.priority != ri.priority ||
r0.isDefault != ri.isDefault) {
while (i < N) {
- mCurrentResolveList.remove(i);
+ currentResolveList.remove(i);
N--;
}
}
@@ -480,11 +481,8 @@ public class ResolverActivity extends AlertActivity implements AdapterView.OnIte
if (N > 1) {
ResolveInfo.DisplayNameComparator rComparator =
new ResolveInfo.DisplayNameComparator(mPm);
- Collections.sort(mCurrentResolveList, rComparator);
+ Collections.sort(currentResolveList, rComparator);
}
-
- mList = new ArrayList<DisplayResolveInfo>();
-
// First put the initial items at the top.
if (mInitialIntents != null) {
for (int i=0; i<mInitialIntents.length; i++) {
@@ -512,10 +510,10 @@ public class ResolverActivity extends AlertActivity implements AdapterView.OnIte
ri.loadLabel(getPackageManager()), null, ii));
}
}
-
+
// Check for applications with same name and use application name or
// package name if necessary
- r0 = mCurrentResolveList.get(0);
+ r0 = currentResolveList.get(0);
int start = 0;
CharSequence r0Label = r0.loadLabel(mPm);
mShowExtended = false;
@@ -523,7 +521,7 @@ public class ResolverActivity extends AlertActivity implements AdapterView.OnIte
if (r0Label == null) {
r0Label = r0.activityInfo.packageName;
}
- ResolveInfo ri = mCurrentResolveList.get(i);
+ ResolveInfo ri = currentResolveList.get(i);
CharSequence riLabel = ri.loadLabel(mPm);
if (riLabel == null) {
riLabel = ri.activityInfo.packageName;
@@ -531,13 +529,13 @@ public class ResolverActivity extends AlertActivity implements AdapterView.OnIte
if (riLabel.equals(r0Label)) {
continue;
}
- processGroup(mCurrentResolveList, start, (i-1), r0, r0Label);
+ processGroup(currentResolveList, start, (i-1), r0, r0Label);
r0 = ri;
r0Label = riLabel;
start = i;
}
// Process last group
- processGroup(mCurrentResolveList, start, (N-1), r0, r0Label);
+ processGroup(currentResolveList, start, (N-1), r0, r0Label);
}
}
@@ -589,18 +587,10 @@ public class ResolverActivity extends AlertActivity implements AdapterView.OnIte
}
public ResolveInfo resolveInfoForPosition(int position) {
- if (mList == null) {
- return null;
- }
-
return mList.get(position).ri;
}
public Intent intentForPosition(int position) {
- if (mList == null) {
- return null;
- }
-
DisplayResolveInfo dri = mList.get(position);
Intent intent = new Intent(dri.origIntent != null
@@ -614,11 +604,11 @@ public class ResolverActivity extends AlertActivity implements AdapterView.OnIte
}
public int getCount() {
- return mList != null ? mList.size() : 0;
+ return mList.size();
}
public Object getItem(int position) {
- return position;
+ return mList.get(position);
}
public long getItemId(int position) {
diff --git a/core/java/com/android/internal/backup/LocalTransport.java b/core/java/com/android/internal/backup/LocalTransport.java
index eed3e67..eb2d1fe 100644
--- a/core/java/com/android/internal/backup/LocalTransport.java
+++ b/core/java/com/android/internal/backup/LocalTransport.java
@@ -27,6 +27,7 @@ import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Environment;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
+import android.os.SELinux;
import android.util.Log;
import com.android.org.bouncycastle.util.encoders.Base64;
@@ -64,6 +65,10 @@ public class LocalTransport extends IBackupTransport.Stub {
public LocalTransport(Context context) {
mContext = context;
+ mDataDir.mkdirs();
+ if (!SELinux.restorecon(mDataDir)) {
+ Log.e(TAG, "SELinux restorecon failed for " + mDataDir);
+ }
}
public Intent configurationIntent() {
diff --git a/core/java/com/android/internal/os/PkgUsageStats.aidl b/core/java/com/android/internal/os/PkgUsageStats.aidl
index 8305271..8305271 100755..100644
--- a/core/java/com/android/internal/os/PkgUsageStats.aidl
+++ b/core/java/com/android/internal/os/PkgUsageStats.aidl
diff --git a/core/java/com/android/internal/os/PkgUsageStats.java b/core/java/com/android/internal/os/PkgUsageStats.java
index 8c2c405..8c2c405 100755..100644
--- a/core/java/com/android/internal/os/PkgUsageStats.java
+++ b/core/java/com/android/internal/os/PkgUsageStats.java
diff --git a/core/java/com/android/internal/os/SamplingProfilerIntegration.java b/core/java/com/android/internal/os/SamplingProfilerIntegration.java
index df0fcd9..6429aa4 100644
--- a/core/java/com/android/internal/os/SamplingProfilerIntegration.java
+++ b/core/java/com/android/internal/os/SamplingProfilerIntegration.java
@@ -106,7 +106,7 @@ public class SamplingProfilerIntegration {
}
ThreadGroup group = Thread.currentThread().getThreadGroup();
- SamplingProfiler.ThreadSet threadSet = SamplingProfiler.newThreadGroupTheadSet(group);
+ SamplingProfiler.ThreadSet threadSet = SamplingProfiler.newThreadGroupThreadSet(group);
samplingProfiler = new SamplingProfiler(samplingProfilerDepth, threadSet);
samplingProfiler.start(samplingProfilerMilliseconds);
startMillis = System.currentTimeMillis();
diff --git a/core/java/com/android/internal/util/AsyncChannel.java b/core/java/com/android/internal/util/AsyncChannel.java
index 5093b4d..52281d9 100644
--- a/core/java/com/android/internal/util/AsyncChannel.java
+++ b/core/java/com/android/internal/util/AsyncChannel.java
@@ -180,6 +180,9 @@ public class AsyncChannel {
/** CMD_FULLY_CONNECTED refused because a connection already exists*/
public static final int STATUS_FULL_CONNECTION_REFUSED_ALREADY_CONNECTED = 3;
+ /** Error indicating abnormal termination of destination messenger */
+ public static final int STATUS_REMOTE_DISCONNECTION = 4;
+
/** Service connection */
private AsyncChannelConnection mConnection;
@@ -195,6 +198,9 @@ public class AsyncChannel {
/** Messenger for destination */
private Messenger mDstMessenger;
+ /** Death Monitor for destination messenger */
+ private DeathMonitor mDeathMonitor;
+
/**
* AsyncChannel constructor
*/
@@ -434,6 +440,7 @@ public class AsyncChannel {
mSrcHandler = null;
mSrcMessenger = null;
mDstMessenger = null;
+ mDeathMonitor = null;
mConnection = null;
}
@@ -457,6 +464,10 @@ public class AsyncChannel {
if (mSrcHandler != null) {
replyDisconnected(STATUS_SUCCESSFUL);
}
+ // Unlink only when bindService isn't used
+ if (mConnection == null && mDstMessenger != null && mDeathMonitor!= null) {
+ mDstMessenger.getBinder().unlinkToDeath(mDeathMonitor, 0);
+ }
}
/**
@@ -832,6 +843,21 @@ public class AsyncChannel {
msg.arg1 = status;
msg.obj = this;
msg.replyTo = mDstMessenger;
+
+ /*
+ * Link to death only when bindService isn't used.
+ */
+ if (mConnection == null) {
+ mDeathMonitor = new DeathMonitor();
+ try {
+ mDstMessenger.getBinder().linkToDeath(mDeathMonitor, 0);
+ } catch (RemoteException e) {
+ mDeathMonitor = null;
+ // Override status to indicate failure
+ msg.arg1 = STATUS_BINDING_UNSUCCESSFUL;
+ }
+ }
+
mSrcHandler.sendMessage(msg);
}
@@ -877,4 +903,15 @@ public class AsyncChannel {
private static void log(String s) {
Slog.d(TAG, s);
}
+
+ private final class DeathMonitor implements IBinder.DeathRecipient {
+
+ DeathMonitor() {
+ }
+
+ public void binderDied() {
+ replyDisconnected(STATUS_REMOTE_DISCONNECTION);
+ }
+
+ }
}
diff --git a/core/java/com/android/internal/view/menu/MenuItemImpl.java b/core/java/com/android/internal/view/menu/MenuItemImpl.java
index 9f7441d..7189610 100644
--- a/core/java/com/android/internal/view/menu/MenuItemImpl.java
+++ b/core/java/com/android/internal/view/menu/MenuItemImpl.java
@@ -93,6 +93,7 @@ public final class MenuItemImpl implements MenuItem {
*/
private ContextMenuInfo mMenuInfo;
+ private static String sLanguage;
private static String sPrependShortcutLabel;
private static String sEnterShortcutLabel;
private static String sDeleteShortcutLabel;
@@ -114,7 +115,9 @@ public final class MenuItemImpl implements MenuItem {
MenuItemImpl(MenuBuilder menu, int group, int id, int categoryOrder, int ordering,
CharSequence title, int showAsAction) {
- if (sPrependShortcutLabel == null) {
+ String lang = menu.getContext().getResources().getConfiguration().locale.toString();
+ if (sPrependShortcutLabel == null || !lang.equals(sLanguage)) {
+ sLanguage = lang;
// This is instantiated from the UI thread, so no chance of sync issues
sPrependShortcutLabel = menu.getContext().getResources().getString(
com.android.internal.R.string.prepend_shortcut_label);