Merge "Add getters for ListView header & footer divider drawing attrs."
diff --git a/Android.mk b/Android.mk
index fad3f13..f0828b7 100644
--- a/Android.mk
+++ b/Android.mk
@@ -119,6 +119,12 @@
core/java/android/content/pm/IPackageMoveObserver.aidl \
core/java/android/content/pm/IPackageStatsObserver.aidl \
core/java/android/database/IContentObserver.aidl \
+ core/java/android/hardware/ICameraService.aidl \
+ core/java/android/hardware/ICameraServiceListener.aidl \
+ core/java/android/hardware/ICamera.aidl \
+ core/java/android/hardware/ICameraClient.aidl \
+ core/java/android/hardware/IProCameraUser.aidl \
+ core/java/android/hardware/IProCameraCallbacks.aidl \
core/java/android/hardware/ISerialManager.aidl \
core/java/android/hardware/display/IDisplayManager.aidl \
core/java/android/hardware/display/IDisplayManagerCallback.aidl \
diff --git a/api/current.txt b/api/current.txt
index 5c51f3a..520d0fe 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -514,7 +514,7 @@
field public static final int freezesText = 16843116; // 0x101016c
field public static final int fromAlpha = 16843210; // 0x10101ca
field public static final int fromDegrees = 16843187; // 0x10101b3
- field public static final int fromScene = 16843740; // 0x10103dc
+ field public static final int fromScene = 16843741; // 0x10103dd
field public static final int fromXDelta = 16843206; // 0x10101c6
field public static final int fromXScale = 16843202; // 0x10101c2
field public static final int fromYDelta = 16843208; // 0x10101c8
@@ -629,7 +629,7 @@
field public static final int keyboardLayout = 16843691; // 0x10103ab
field public static final int keyboardMode = 16843341; // 0x101024d
field public static final int keycode = 16842949; // 0x10100c5
- field public static final int keyset = 16843738; // 0x10103da
+ field public static final int keyset = 16843739; // 0x10103db
field public static final int killAfterRestore = 16843420; // 0x101029c
field public static final int label = 16842753; // 0x1010001
field public static final int labelFor = 16843718; // 0x10103c6
@@ -642,6 +642,7 @@
field public static final int layout = 16842994; // 0x10100f2
field public static final int layoutAnimation = 16842988; // 0x10100ec
field public static final int layoutDirection = 16843698; // 0x10103b2
+ field public static final int layoutMode = 16843738; // 0x10103da
field public static final int layout_above = 16843140; // 0x1010184
field public static final int layout_alignBaseline = 16843142; // 0x1010186
field public static final int layout_alignBottom = 16843146; // 0x101018a
@@ -1015,7 +1016,7 @@
field public static final int targetActivity = 16843266; // 0x1010202
field public static final int targetClass = 16842799; // 0x101002f
field public static final int targetDescriptions = 16843680; // 0x10103a0
- field public static final int targetID = 16843739; // 0x10103db
+ field public static final int targetID = 16843740; // 0x10103dc
field public static final int targetPackage = 16842785; // 0x1010021
field public static final int targetSdkVersion = 16843376; // 0x1010270
field public static final int taskAffinity = 16842770; // 0x1010012
@@ -1104,7 +1105,7 @@
field public static final int titleTextStyle = 16843512; // 0x10102f8
field public static final int toAlpha = 16843211; // 0x10101cb
field public static final int toDegrees = 16843188; // 0x10101b4
- field public static final int toScene = 16843741; // 0x10103dd
+ field public static final int toScene = 16843742; // 0x10103de
field public static final int toXDelta = 16843207; // 0x10101c7
field public static final int toXScale = 16843203; // 0x10101c3
field public static final int toYDelta = 16843209; // 0x10101c9
@@ -1119,7 +1120,7 @@
field public static final int transcriptMode = 16843008; // 0x1010100
field public static final int transformPivotX = 16843552; // 0x1010320
field public static final int transformPivotY = 16843553; // 0x1010321
- field public static final int transition = 16843742; // 0x10103de
+ field public static final int transition = 16843743; // 0x10103df
field public static final int translationX = 16843554; // 0x1010322
field public static final int translationY = 16843555; // 0x1010323
field public static final int type = 16843169; // 0x10101a1
@@ -2882,6 +2883,7 @@
}
public class ActivityManager {
+ method public void dumpPackageState(java.io.FileDescriptor, java.lang.String);
method public android.content.pm.ConfigurationInfo getDeviceConfigurationInfo();
method public int getLargeMemoryClass();
method public int getLauncherLargeIconDensity();
@@ -12150,6 +12152,7 @@
ctor public MediaExtractor();
method public boolean advance();
method public long getCachedDuration();
+ method public java.util.Map<java.util.UUID, byte[]> getPsshInfo();
method public boolean getSampleCryptoInfo(android.media.MediaCodec.CryptoInfo);
method public int getSampleFlags();
method public long getSampleTime();
diff --git a/cmds/pm/src/com/android/commands/pm/Pm.java b/cmds/pm/src/com/android/commands/pm/Pm.java
index 224945a..6f57ae0 100644
--- a/cmds/pm/src/com/android/commands/pm/Pm.java
+++ b/cmds/pm/src/com/android/commands/pm/Pm.java
@@ -16,8 +16,7 @@
package com.android.commands.pm;
-import com.android.internal.content.PackageHelper;
-
+import android.app.ActivityManager;
import android.app.ActivityManagerNative;
import android.content.ComponentName;
import android.content.pm.ApplicationInfo;
@@ -46,6 +45,7 @@
import android.os.UserManager;
import java.io.File;
+import java.io.FileDescriptor;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.security.InvalidAlgorithmParameterException;
@@ -59,6 +59,8 @@
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
+import com.android.internal.content.PackageHelper;
+
public final class Pm {
IPackageManager mPm;
IUserManager mUm;
@@ -105,6 +107,11 @@
return;
}
+ if ("dump".equals(op)) {
+ runDump();
+ return;
+ }
+
if ("install".equals(op)) {
runInstall();
return;
@@ -672,6 +679,15 @@
displayPackageFilePath(pkg);
}
+ private void runDump() {
+ String pkg = nextArg();
+ if (pkg == null) {
+ System.err.println("Error: no package specified");
+ return;
+ }
+ ActivityManager.dumpPackageStateStatic(FileDescriptor.out, pkg);
+ }
+
class PackageInstallObserver extends IPackageInstallObserver.Stub {
boolean finished;
int result;
@@ -1456,6 +1472,7 @@
System.err.println(" pm list libraries");
System.err.println(" pm list users");
System.err.println(" pm path PACKAGE");
+ System.err.println(" pm dump PACKAGE");
System.err.println(" pm install [-l] [-r] [-t] [-i INSTALLER_PACKAGE_NAME] [-s] [-f]");
System.err.println(" [--algo <algorithm name> --key <key-in-hex> --iv <IV-in-hex>]");
System.err.println(" [--originating-uri <URI>] [--referrer <URI>] PATH");
@@ -1506,6 +1523,8 @@
System.err.println("");
System.err.println("pm path: print the path to the .apk of the given PACKAGE.");
System.err.println("");
+ System.err.println("pm dump: print system state associated w ith the given PACKAGE.");
+ System.err.println("");
System.err.println("pm install: installs a package to the system. Options:");
System.err.println(" -l: install the package with FORWARD_LOCK.");
System.err.println(" -r: reinstall an exisiting app, keeping its data.");
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index 63ac42e..f523b55 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -16,8 +16,10 @@
package android.app;
+import android.os.IBinder;
import com.android.internal.app.IUsageStats;
import com.android.internal.os.PkgUsageStats;
+import com.android.internal.os.TransferPipe;
import com.android.internal.util.MemInfoReader;
import android.content.ComponentName;
@@ -49,6 +51,9 @@
import android.util.Slog;
import android.view.Display;
+import java.io.FileDescriptor;
+import java.io.FileOutputStream;
+import java.io.PrintWriter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -1709,7 +1714,7 @@
public ComponentName importanceReasonComponent;
/**
- * When {@link importanceReasonPid} is non-0, this is the importance
+ * When {@link #importanceReasonPid} is non-0, this is the importance
* of the other pid. @hide
*/
public int importanceReasonImportance;
@@ -2181,4 +2186,54 @@
return false;
}
}
+
+ /**
+ * Perform a system dump of various state associated with the given application
+ * package name. This call blocks while the dump is being performed, so should
+ * not be done on a UI thread. The data will be written to the given file
+ * descriptor as text. An application must hold the
+ * {@link android.Manifest.permission#DUMP} permission to make this call.
+ * @param fd The file descriptor that the dump should be written to.
+ * @param packageName The name of the package that is to be dumped.
+ */
+ public void dumpPackageState(FileDescriptor fd, String packageName) {
+ dumpPackageStateStatic(fd, packageName);
+ }
+
+ /**
+ * @hide
+ */
+ public static void dumpPackageStateStatic(FileDescriptor fd, String packageName) {
+ FileOutputStream fout = new FileOutputStream(fd);
+ PrintWriter pw = new PrintWriter(fout);
+ dumpService(pw, fd, Context.ACTIVITY_SERVICE, new String[] { "package", packageName});
+ pw.println();
+ dumpService(pw, fd, "package", new String[] { packageName});
+ pw.println();
+ dumpService(pw, fd, "batteryinfo", new String[] { packageName});
+ pw.flush();
+ }
+
+ private static void dumpService(PrintWriter pw, FileDescriptor fd, String name, String[] args) {
+ pw.print("DUMP OF SERVICE "); pw.print(name); pw.println(":");
+ IBinder service = ServiceManager.checkService(name);
+ if (service == null) {
+ pw.println(" (Service not found)");
+ return;
+ }
+ TransferPipe tp = null;
+ try {
+ pw.flush();
+ tp = new TransferPipe();
+ tp.setBufferPrefix(" ");
+ service.dump(tp.getWriteFd().getFileDescriptor(), args);
+ tp.go(fd);
+ } catch (Throwable e) {
+ if (tp != null) {
+ tp.kill();
+ }
+ pw.println("Failure dumping service:");
+ e.printStackTrace(pw);
+ }
+ }
}
diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java
index 79bb476..72ecda1 100644
--- a/core/java/android/bluetooth/BluetoothAdapter.java
+++ b/core/java/android/bluetooth/BluetoothAdapter.java
@@ -36,6 +36,7 @@
import java.util.HashSet;
import java.util.HashMap;
import java.util.LinkedList;
+import java.util.Locale;
import java.util.Map;
import java.util.Random;
import java.util.Set;
@@ -433,7 +434,7 @@
if (address == null || address.length != 6) {
throw new IllegalArgumentException("Bluetooth address must have 6 bytes");
}
- return new BluetoothDevice(String.format("%02X:%02X:%02X:%02X:%02X:%02X",
+ return new BluetoothDevice(String.format(Locale.US, "%02X:%02X:%02X:%02X:%02X:%02X",
address[0], address[1], address[2], address[3], address[4], address[5]));
}
diff --git a/core/java/android/bluetooth/BluetoothSocket.java b/core/java/android/bluetooth/BluetoothSocket.java
index a19341c..d10eaea 100644
--- a/core/java/android/bluetooth/BluetoothSocket.java
+++ b/core/java/android/bluetooth/BluetoothSocket.java
@@ -31,6 +31,7 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.util.List;
+import java.util.Locale;
import java.util.UUID;
import android.net.LocalSocket;
import java.nio.ByteOrder;
@@ -473,7 +474,7 @@
return mPort;
}
private String convertAddr(final byte[] addr) {
- return String.format("%02X:%02X:%02X:%02X:%02X:%02X",
+ return String.format(Locale.US, "%02X:%02X:%02X:%02X:%02X:%02X",
addr[0] , addr[1], addr[2], addr[3] , addr[4], addr[5]);
}
private String waitSocketSignal(InputStream is) throws IOException {
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
index ac42b76..feb47aa 100644
--- a/core/java/android/hardware/Camera.java
+++ b/core/java/android/hardware/Camera.java
@@ -2769,21 +2769,24 @@
* JPEG {@link PictureCallback}. The camera driver may set orientation
* in the EXIF header without rotating the picture. Or the driver may
* rotate the picture and the EXIF thumbnail. If the Jpeg picture is
- * rotated, the orientation in the EXIF header will be missing or 1
- * (row #0 is top and column #0 is left side).
+ * rotated, the orientation in the EXIF header will be missing or 1 (row
+ * #0 is top and column #0 is left side).
*
- * <p>If applications want to rotate the picture to match the orientation
- * of what users see, apps should use {@link
- * android.view.OrientationEventListener} and {@link CameraInfo}.
- * The value from OrientationEventListener is relative to the natural
- * orientation of the device. CameraInfo.orientation is the angle
- * between camera orientation and natural device orientation. The sum
- * of the two is the rotation angle for back-facing camera. The
- * difference of the two is the rotation angle for front-facing camera.
- * Note that the JPEG pictures of front-facing cameras are not mirrored
- * as in preview display.
+ * <p>
+ * If applications want to rotate the picture to match the orientation
+ * of what users see, apps should use
+ * {@link android.view.OrientationEventListener} and
+ * {@link android.hardware.Camera.CameraInfo}. The value from
+ * OrientationEventListener is relative to the natural orientation of
+ * the device. CameraInfo.orientation is the angle between camera
+ * orientation and natural device orientation. The sum of the two is the
+ * rotation angle for back-facing camera. The difference of the two is
+ * the rotation angle for front-facing camera. Note that the JPEG
+ * pictures of front-facing cameras are not mirrored as in preview
+ * display.
*
- * <p>For example, suppose the natural orientation of the device is
+ * <p>
+ * For example, suppose the natural orientation of the device is
* portrait. The device is rotated 270 degrees clockwise, so the device
* orientation is 270. Suppose a back-facing camera sensor is mounted in
* landscape and the top side of the camera sensor is aligned with the
diff --git a/core/java/android/hardware/CameraInfo.aidl b/core/java/android/hardware/CameraInfo.aidl
new file mode 100644
index 0000000..e21e694
--- /dev/null
+++ b/core/java/android/hardware/CameraInfo.aidl
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2013 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.hardware;
+
+/** @hide */
+parcelable CameraInfo;
diff --git a/core/java/android/hardware/CameraInfo.java b/core/java/android/hardware/CameraInfo.java
new file mode 100644
index 0000000..53da0ce
--- /dev/null
+++ b/core/java/android/hardware/CameraInfo.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2013 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.hardware;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * Information about a camera
+ *
+ * @hide
+ */
+public class CameraInfo implements Parcelable {
+ // Can't parcel nested classes, so make this a top level class that composes
+ // CameraInfo.
+ public Camera.CameraInfo info = new Camera.CameraInfo();
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel out, int flags) {
+ out.writeInt(info.facing);
+ out.writeInt(info.orientation);
+ }
+
+ public void readFromParcel(Parcel in) {
+ info.facing = in.readInt();
+ info.orientation = in.readInt();
+ }
+
+ public static final Parcelable.Creator<CameraInfo> CREATOR =
+ new Parcelable.Creator<CameraInfo>() {
+ @Override
+ public CameraInfo createFromParcel(Parcel in) {
+ CameraInfo info = new CameraInfo();
+ info.readFromParcel(in);
+
+ return info;
+ }
+
+ @Override
+ public CameraInfo[] newArray(int size) {
+ return new CameraInfo[size];
+ }
+ };
+};
diff --git a/core/java/android/hardware/ICamera.aidl b/core/java/android/hardware/ICamera.aidl
new file mode 100644
index 0000000..d4f64f8
--- /dev/null
+++ b/core/java/android/hardware/ICamera.aidl
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2013 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.hardware;
+
+/** @hide */
+interface ICamera
+{
+ /**
+ * Keep up-to-date with frameworks/av/include/camera/ICamera.h
+ */
+ void disconnect();
+}
diff --git a/core/java/android/hardware/ICameraClient.aidl b/core/java/android/hardware/ICameraClient.aidl
new file mode 100644
index 0000000..d7877b4
--- /dev/null
+++ b/core/java/android/hardware/ICameraClient.aidl
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2013 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.hardware;
+
+/** @hide */
+interface ICameraClient
+{
+ /**
+ * Keep up-to-date with frameworks/av/include/camera/ICameraClient.h
+ */
+ // TODO: consider implementing this.
+}
diff --git a/core/java/android/hardware/ICameraService.aidl b/core/java/android/hardware/ICameraService.aidl
new file mode 100644
index 0000000..b8fbfdb
--- /dev/null
+++ b/core/java/android/hardware/ICameraService.aidl
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2013 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.hardware;
+
+import android.hardware.ICamera;
+import android.hardware.ICameraClient;
+import android.hardware.IProCameraUser;
+import android.hardware.IProCameraCallbacks;
+import android.hardware.ICameraServiceListener;
+import android.hardware.CameraInfo;
+
+/** @hide */
+interface ICameraService
+{
+ /**
+ * Keep up-to-date with frameworks/av/include/camera/ICameraService.h
+ */
+ int getNumberOfCameras();
+
+ // rest of 'int' return values in this file are actually status_t
+
+ int getCameraInfo(int cameraId, out CameraInfo info);
+
+ ICamera connect(ICameraClient client, int cameraId,
+ String clientPackageName,
+ int clientUid);
+
+ IProCameraUser connectPro(IProCameraCallbacks callbacks, int cameraId,
+ String clientPackageName,
+ int clientUid);
+
+ int addListener(ICameraServiceListener listener);
+ int removeListener(ICameraServiceListener listener);
+}
diff --git a/core/java/android/hardware/ICameraServiceListener.aidl b/core/java/android/hardware/ICameraServiceListener.aidl
new file mode 100644
index 0000000..c5484965
--- /dev/null
+++ b/core/java/android/hardware/ICameraServiceListener.aidl
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2013 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.hardware;
+
+/** @hide */
+interface ICameraServiceListener
+{
+ /**
+ * Keep up-to-date with frameworks/av/include/camera/ICameraServiceListener.h
+ */
+ void onStatusChanged(int status, int cameraId);
+}
diff --git a/core/java/android/hardware/IProCameraCallbacks.aidl b/core/java/android/hardware/IProCameraCallbacks.aidl
new file mode 100644
index 0000000..a09b452
--- /dev/null
+++ b/core/java/android/hardware/IProCameraCallbacks.aidl
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2013 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.hardware;
+
+/** @hide */
+interface IProCameraCallbacks
+{
+ /**
+ * Keep up-to-date with frameworks/av/include/camera/IProCameraCallbacks.h
+ */
+ // TODO: consider implementing this.
+}
diff --git a/core/java/android/hardware/IProCameraUser.aidl b/core/java/android/hardware/IProCameraUser.aidl
new file mode 100644
index 0000000..eacb0f4
--- /dev/null
+++ b/core/java/android/hardware/IProCameraUser.aidl
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2013 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.hardware;
+
+/** @hide */
+interface IProCameraUser
+{
+ /**
+ * Keep up-to-date with frameworks/av/include/camera/IProCameraUser.h
+ */
+ void disconnect();
+}
diff --git a/core/java/android/net/NetworkUtils.java b/core/java/android/net/NetworkUtils.java
index 4ab479e..333fcc6 100644
--- a/core/java/android/net/NetworkUtils.java
+++ b/core/java/android/net/NetworkUtils.java
@@ -21,6 +21,7 @@
import java.net.Inet6Address;
import java.net.UnknownHostException;
import java.util.Collection;
+import java.util.Locale;
import android.util.Log;
@@ -223,7 +224,7 @@
public static InetAddress hexToInet6Address(String addrHexString)
throws IllegalArgumentException {
try {
- return numericToInetAddress(String.format("%s:%s:%s:%s:%s:%s:%s:%s",
+ return numericToInetAddress(String.format(Locale.US, "%s:%s:%s:%s:%s:%s:%s:%s",
addrHexString.substring(0,4), addrHexString.substring(4,8),
addrHexString.substring(8,12), addrHexString.substring(12,16),
addrHexString.substring(16,20), addrHexString.substring(20,24),
diff --git a/core/java/android/net/VpnService.java b/core/java/android/net/VpnService.java
index 65d3f2b..733de94 100644
--- a/core/java/android/net/VpnService.java
+++ b/core/java/android/net/VpnService.java
@@ -17,8 +17,8 @@
package android.net;
import android.app.Activity;
-import android.app.Service;
import android.app.PendingIntent;
+import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.os.Binder;
@@ -30,10 +30,10 @@
import com.android.internal.net.VpnConfig;
-import java.net.InetAddress;
+import java.net.DatagramSocket;
import java.net.Inet4Address;
import java.net.Inet6Address;
-import java.net.DatagramSocket;
+import java.net.InetAddress;
import java.net.Socket;
import java.util.ArrayList;
@@ -329,7 +329,8 @@
throw new IllegalArgumentException("Bad address");
}
- mAddresses.append(' ' + address.getHostAddress() + '/' + prefixLength);
+ mAddresses.append(' ')
+ .append(address.getHostAddress()).append('/').append(prefixLength);
return this;
}
@@ -364,7 +365,7 @@
}
}
- mRoutes.append(String.format(" %s/%d", address.getHostAddress(), prefixLength));
+ mRoutes.append(' ').append(address.getHostAddress()).append('/').append(prefixLength);
return this;
}
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index 32bbfbd..fef1818 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -2279,7 +2279,7 @@
* @param pw a Printer to receive the dump output.
*/
@SuppressWarnings("unused")
- public void dumpLocked(PrintWriter pw, boolean isUnpluggedOnly) {
+ public void dumpLocked(PrintWriter pw, boolean isUnpluggedOnly, int reqUid) {
prepareForDumpLocked();
long now = getHistoryBaseTime() + SystemClock.elapsedRealtime();
@@ -2336,11 +2336,11 @@
pw.println("Statistics since last charge:");
pw.println(" System starts: " + getStartCount()
+ ", currently on battery: " + getIsOnBattery());
- dumpLocked(pw, "", STATS_SINCE_CHARGED, -1);
+ dumpLocked(pw, "", STATS_SINCE_CHARGED, reqUid);
pw.println("");
}
pw.println("Statistics since last unplugged:");
- dumpLocked(pw, "", STATS_SINCE_UNPLUGGED, -1);
+ dumpLocked(pw, "", STATS_SINCE_UNPLUGGED, reqUid);
}
@SuppressWarnings("unused")
diff --git a/core/java/android/util/ArrayMap.java b/core/java/android/util/ArrayMap.java
index bb0a6e1..4bd9b37 100644
--- a/core/java/android/util/ArrayMap.java
+++ b/core/java/android/util/ArrayMap.java
@@ -206,6 +206,7 @@
}
mSize = 0;
}
+
/**
* Create a new ArrayMap with the mappings from the given ArrayMap.
*/
@@ -216,7 +217,6 @@
}
}
-
/**
* Make the array map empty. All storage is released.
*/
@@ -236,8 +236,8 @@
*/
public void ensureCapacity(int minimumCapacity) {
if (mHashes.length < minimumCapacity) {
- int[] ohashes = mHashes;
- Object[] oarray = mArray;
+ final int[] ohashes = mHashes;
+ final Object[] oarray = mArray;
allocArrays(minimumCapacity);
if (mSize > 0) {
System.arraycopy(ohashes, 0, mHashes, 0, mSize);
@@ -493,6 +493,63 @@
return mSize;
}
+ /**
+ * {@inheritDoc}
+ *
+ * <p>This implementation returns false if the object is not a map, or
+ * if the maps have different sizes. Otherwise, for each key in this map,
+ * values of both maps are compared. If the values for any key are not
+ * equal, the method returns false, otherwise it returns true.
+ */
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof Map) {
+ Map<?, ?> map = (Map<?, ?>) object;
+ if (size() != map.size()) {
+ return false;
+ }
+
+ try {
+ for (int i=0; i<mSize; i++) {
+ K key = keyAt(i);
+ V mine = valueAt(i);
+ Object theirs = map.get(key);
+ if (mine == null) {
+ if (theirs != null || !map.containsKey(key)) {
+ return false;
+ }
+ } else if (!mine.equals(theirs)) {
+ return false;
+ }
+ }
+ } catch (NullPointerException ignored) {
+ return false;
+ } catch (ClassCastException ignored) {
+ return false;
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int hashCode() {
+ final int[] hashes = mHashes;
+ final Object[] array = mArray;
+ int result = 0;
+ for (int i = 0, v = 1, s = mSize; i < s; i++, v+=2) {
+ Object value = array[v];
+ result += hashes[i] ^ (value == null ? 0 : value.hashCode());
+ }
+ return result;
+ }
+
// ------------------------------------------------------------------------
// Interop with traditional Java containers. Not as efficient as using
// specialized collection APIs.
@@ -632,64 +689,4 @@
public Collection<V> values() {
return getCollection().getValues();
}
-
- /**
- * {@inheritDoc}
- *
- * <p>This implementation returns false if the object is not a map, or
- * if the maps have different sizes. Otherwise, for each key in this map,
- * values of both maps are compared. If the values for any key are not
- * equal, the method returns false, otherwise it returns true.
- */
- @Override
- public boolean equals(Object object) {
- if (this == object) {
- return true;
- }
- if (object instanceof Map) {
- Map<?, ?> map = (Map<?, ?>) object;
- if (size() != map.size()) {
- return false;
- }
-
- try {
- for (int i=0; i<mSize; i++) {
- K key = keyAt(i);
- V mine = valueAt(i);
- Object theirs = map.get(key);
- if (mine == null) {
- if (theirs != null || !map.containsKey(key)) {
- return false;
- }
- } else if (!mine.equals(theirs)) {
- return false;
- }
- }
- } catch (NullPointerException ignored) {
- return false;
- } catch (ClassCastException ignored) {
- return false;
- }
- return true;
- }
- return false;
- }
-
- /**
- * {@inheritDoc}
- *
- * <p>This implementation sums a hashcode using all keys and values.
- */
- @Override
- public int hashCode() {
- int result = 0;
- for (int i=0; i<mSize; i++) {
- K key = keyAt(i);
- V value = valueAt(i);
- result += (key == null ? 0 : key.hashCode())
- ^ (value == null ? 0 : value.hashCode());
- }
- return result;
- }
-
}
diff --git a/core/java/android/util/ArraySet.java b/core/java/android/util/ArraySet.java
new file mode 100644
index 0000000..a84c47c
--- /dev/null
+++ b/core/java/android/util/ArraySet.java
@@ -0,0 +1,599 @@
+/*
+ * Copyright (C) 2013 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;
+
+import java.lang.reflect.Array;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * ArraySet is a generic set data structure that is designed to be more memory efficient than a
+ * traditional {@link java.util.HashSet}. The design is very similar to
+ * {@link ArrayMap}, with all of the caveats described there. This implementation is
+ * separate from ArrayMap, however, so the Object array contains only one item for each
+ * entry in the set (instead of a pair for a mapping).
+ *
+ * <p>Note that this implementation is not intended to be appropriate for data structures
+ * that may contain large numbers of items. It is generally slower than a traditional
+ * HashSet, since lookups require a binary search and adds and removes require inserting
+ * and deleting entries in the array. For containers holding up to hundreds of items,
+ * the performance difference is not significant, less than 50%. For larger numbers of items
+ * this data structure should be avoided.</p>
+ *
+ * <p><b>Note:</b> unlike {@link java.util.HashSet}, this container does not support
+ * null values.</p>
+ *
+ * <p>Because this container is intended to better balance memory use, unlike most other
+ * standard Java containers it will shrink its array as items are removed from it. Currently
+ * you have no control over this shrinking -- if you set a capacity and then remove an
+ * item, it may reduce the capacity to better match the current size. In the future an
+ * explicitly call to set the capacity should turn off this aggressive shrinking behavior.</p>
+ *
+ * @hide
+ */
+public final class ArraySet<E> implements Collection<E>, Set<E> {
+ private static final boolean DEBUG = false;
+ private static final String TAG = "ArraySet";
+
+ /**
+ * The minimum amount by which the capacity of a ArraySet will increase.
+ * This is tuned to be relatively space-efficient.
+ */
+ private static final int BASE_SIZE = 4;
+
+ /**
+ * Maximum number of entries to have in array caches.
+ */
+ private static final int CACHE_SIZE = 10;
+
+ /**
+ * Caches of small array objects to avoid spamming garbage. The cache
+ * Object[] variable is a pointer to a linked list of array objects.
+ * The first entry in the array is a pointer to the next array in the
+ * list; the second entry is a pointer to the int[] hash code array for it.
+ */
+ static Object[] mBaseCache;
+ static int mBaseCacheSize;
+ static Object[] mTwiceBaseCache;
+ static int mTwiceBaseCacheSize;
+
+ int[] mHashes;
+ Object[] mArray;
+ int mSize;
+ MapCollections<E, E> mCollections;
+
+ private int indexOf(Object key, int hash) {
+ final int N = mSize;
+
+ // Important fast case: if nothing is in here, nothing to look for.
+ if (N == 0) {
+ return ~0;
+ }
+
+ int index = SparseArray.binarySearch(mHashes, N, hash);
+
+ // If the hash code wasn't found, then we have no entry for this key.
+ if (index < 0) {
+ return index;
+ }
+
+ // If the key at the returned index matches, that's what we want.
+ if (mArray[index].equals(key)) {
+ return index;
+ }
+
+ // Search for a matching key after the index.
+ int end;
+ for (end = index + 1; end < N && mHashes[end] == hash; end++) {
+ if (mArray[end].equals(key)) return end;
+ }
+
+ // Search for a matching key before the index.
+ for (int i = index - 1; i >= 0 && mHashes[i] == hash; i--) {
+ if (mArray[i].equals(key)) return i;
+ }
+
+ // Key not found -- return negative value indicating where a
+ // new entry for this key should go. We use the end of the
+ // hash chain to reduce the number of array entries that will
+ // need to be copied when inserting.
+ return ~end;
+ }
+
+ private void allocArrays(final int size) {
+ if (size == (BASE_SIZE*2)) {
+ synchronized (ArraySet.class) {
+ if (mTwiceBaseCache != null) {
+ final Object[] array = mTwiceBaseCache;
+ mArray = array;
+ mTwiceBaseCache = (Object[])array[0];
+ mHashes = (int[])array[1];
+ array[0] = array[1] = null;
+ mTwiceBaseCacheSize--;
+ if (DEBUG) Log.d(TAG, "Retrieving 2x cache " + mHashes
+ + " now have " + mTwiceBaseCacheSize + " entries");
+ return;
+ }
+ }
+ } else if (size == BASE_SIZE) {
+ synchronized (ArraySet.class) {
+ if (mBaseCache != null) {
+ final Object[] array = mBaseCache;
+ mArray = array;
+ mBaseCache = (Object[])array[0];
+ mHashes = (int[])array[1];
+ array[0] = array[1] = null;
+ mBaseCacheSize--;
+ if (DEBUG) Log.d(TAG, "Retrieving 1x cache " + mHashes
+ + " now have " + mBaseCacheSize + " entries");
+ return;
+ }
+ }
+ }
+
+ mHashes = new int[size];
+ mArray = new Object[size];
+ }
+
+ private static void freeArrays(final int[] hashes, final Object[] array, final int size) {
+ if (hashes.length == (BASE_SIZE*2)) {
+ synchronized (ArraySet.class) {
+ if (mTwiceBaseCacheSize < CACHE_SIZE) {
+ array[0] = mTwiceBaseCache;
+ array[1] = hashes;
+ for (int i=size-1; i>=2; i--) {
+ array[i] = null;
+ }
+ mTwiceBaseCache = array;
+ mTwiceBaseCacheSize++;
+ if (DEBUG) Log.d(TAG, "Storing 2x cache " + array
+ + " now have " + mTwiceBaseCacheSize + " entries");
+ }
+ }
+ } else if (hashes.length == BASE_SIZE) {
+ synchronized (ArraySet.class) {
+ if (mBaseCacheSize < CACHE_SIZE) {
+ array[0] = mBaseCache;
+ array[1] = hashes;
+ for (int i=size-1; i>=2; i--) {
+ array[i] = null;
+ }
+ mBaseCache = array;
+ mBaseCacheSize++;
+ if (DEBUG) Log.d(TAG, "Storing 1x cache " + array
+ + " now have " + mBaseCacheSize + " entries");
+ }
+ }
+ }
+ }
+
+ /**
+ * Create a new empty ArraySet. The default capacity of an array map is 0, and
+ * will grow once items are added to it.
+ */
+ public ArraySet() {
+ mHashes = SparseArray.EMPTY_INTS;
+ mArray = SparseArray.EMPTY_OBJECTS;
+ mSize = 0;
+ }
+
+ /**
+ * Create a new ArraySet with a given initial capacity.
+ */
+ public ArraySet(int capacity) {
+ if (capacity == 0) {
+ mHashes = SparseArray.EMPTY_INTS;
+ mArray = SparseArray.EMPTY_OBJECTS;
+ } else {
+ allocArrays(capacity);
+ }
+ mSize = 0;
+ }
+
+ /**
+ * Create a new ArraySet with the mappings from the given ArraySet.
+ */
+ public ArraySet(ArraySet set) {
+ this();
+ if (set != null) {
+ addAll(set);
+ }
+ }
+
+
+ /**
+ * Make the array map empty. All storage is released.
+ */
+ @Override
+ public void clear() {
+ if (mSize != 0) {
+ freeArrays(mHashes, mArray, mSize);
+ mHashes = SparseArray.EMPTY_INTS;
+ mArray = SparseArray.EMPTY_OBJECTS;
+ mSize = 0;
+ }
+ }
+
+ /**
+ * Ensure the array map can hold at least <var>minimumCapacity</var>
+ * items.
+ */
+ public void ensureCapacity(int minimumCapacity) {
+ if (mHashes.length < minimumCapacity) {
+ final int[] ohashes = mHashes;
+ final Object[] oarray = mArray;
+ allocArrays(minimumCapacity);
+ if (mSize > 0) {
+ System.arraycopy(ohashes, 0, mHashes, 0, mSize);
+ System.arraycopy(oarray, 0, mArray, 0, mSize);
+ }
+ freeArrays(ohashes, oarray, mSize);
+ }
+ }
+
+ /**
+ * Check whether a value exists in the set.
+ *
+ * @param key The value to search for.
+ * @return Returns true if the value exists, else false.
+ */
+ @Override
+ public boolean contains(Object key) {
+ return indexOf(key, key.hashCode()) >= 0;
+ }
+
+ /**
+ * Return the value at the given index in the array.
+ * @param index The desired index, must be between 0 and {@link #size()}-1.
+ * @return Returns the value stored at the given index.
+ */
+ public E valueAt(int index) {
+ return (E)mArray[index];
+ }
+
+ /**
+ * Return true if the array map contains no items.
+ */
+ @Override
+ public boolean isEmpty() {
+ return mSize <= 0;
+ }
+
+ /**
+ * Adds the specified object to this set. The set is not modified if it
+ * already contains the object.
+ *
+ * @param value the object to add.
+ * @return {@code true} if this set is modified, {@code false} otherwise.
+ * @throws ClassCastException
+ * when the class of the object is inappropriate for this set.
+ */
+ @Override
+ public boolean add(E value) {
+ final int hash = value.hashCode();
+ int index = indexOf(value, hash);
+ if (index >= 0) {
+ return false;
+ }
+
+ index = ~index;
+ if (mSize >= mHashes.length) {
+ final int n = mSize >= (BASE_SIZE*2) ? (mSize+(mSize>>1))
+ : (mSize >= BASE_SIZE ? (BASE_SIZE*2) : BASE_SIZE);
+
+ if (DEBUG) Log.d(TAG, "add: grow from " + mHashes.length + " to " + n);
+
+ final int[] ohashes = mHashes;
+ final Object[] oarray = mArray;
+ allocArrays(n);
+
+ if (mHashes.length > 0) {
+ if (DEBUG) Log.d(TAG, "add: copy 0-" + mSize + " to 0");
+ System.arraycopy(ohashes, 0, mHashes, 0, ohashes.length);
+ System.arraycopy(oarray, 0, mArray, 0, oarray.length);
+ }
+
+ freeArrays(ohashes, oarray, mSize);
+ }
+
+ if (index < mSize) {
+ if (DEBUG) Log.d(TAG, "add: move " + index + "-" + (mSize-index)
+ + " to " + (index+1));
+ System.arraycopy(mHashes, index, mHashes, index + 1, mSize - index);
+ System.arraycopy(mArray, index, mArray, index + 1, mSize - index);
+ }
+
+ mHashes[index] = hash;
+ mArray[index] = value;
+ mSize++;
+ return true;
+ }
+
+ /**
+ * Perform a {@link #add(Object)} of all values in <var>array</var>
+ * @param array The array whose contents are to be retrieved.
+ */
+ public void putAll(ArraySet<? extends E> array) {
+ final int N = array.mSize;
+ ensureCapacity(mSize + N);
+ if (mSize == 0) {
+ if (N > 0) {
+ System.arraycopy(array.mHashes, 0, mHashes, 0, N);
+ System.arraycopy(array.mArray, 0, mArray, 0, N);
+ mSize = N;
+ }
+ } else {
+ for (int i=0; i<N; i++) {
+ add(array.valueAt(i));
+ }
+ }
+ }
+
+ /**
+ * Removes the specified object from this set.
+ *
+ * @param object the object to remove.
+ * @return {@code true} if this set was modified, {@code false} otherwise.
+ */
+ @Override
+ public boolean remove(Object object) {
+ int index = indexOf(object, object.hashCode());
+ if (index >= 0) {
+ removeAt(index);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Remove the key/value mapping at the given index.
+ * @param index The desired index, must be between 0 and {@link #size()}-1.
+ * @return Returns the value that was stored at this index.
+ */
+ public E removeAt(int index) {
+ final E old = (E)mArray[index];
+ if (mSize <= 1) {
+ // Now empty.
+ if (DEBUG) Log.d(TAG, "remove: shrink from " + mHashes.length + " to 0");
+ freeArrays(mHashes, mArray, mSize);
+ mHashes = SparseArray.EMPTY_INTS;
+ mArray = SparseArray.EMPTY_OBJECTS;
+ mSize = 0;
+ } else {
+ if (mHashes.length > (BASE_SIZE*2) && mSize < mHashes.length/3) {
+ // Shrunk enough to reduce size of arrays. We don't allow it to
+ // shrink smaller than (BASE_SIZE*2) to avoid flapping between
+ // that and BASE_SIZE.
+ final int n = mSize > (BASE_SIZE*2) ? (mSize + (mSize>>1)) : (BASE_SIZE*2);
+
+ if (DEBUG) Log.d(TAG, "remove: shrink from " + mHashes.length + " to " + n);
+
+ final int[] ohashes = mHashes;
+ final Object[] oarray = mArray;
+ allocArrays(n);
+
+ mSize--;
+ if (index > 0) {
+ if (DEBUG) Log.d(TAG, "remove: copy from 0-" + index + " to 0");
+ System.arraycopy(ohashes, 0, mHashes, 0, index);
+ System.arraycopy(oarray, 0, mArray, 0, index);
+ }
+ if (index < mSize) {
+ if (DEBUG) Log.d(TAG, "remove: copy from " + (index+1) + "-" + mSize
+ + " to " + index);
+ System.arraycopy(ohashes, index + 1, mHashes, index, mSize - index);
+ System.arraycopy(oarray, index + 1, mArray, index, mSize - index);
+ }
+ } else {
+ mSize--;
+ if (index < mSize) {
+ if (DEBUG) Log.d(TAG, "remove: move " + (index+1) + "-" + mSize
+ + " to " + index);
+ System.arraycopy(mHashes, index + 1, mHashes, index, mSize - index);
+ System.arraycopy(mArray, index + 1, mArray, index, mSize - index);
+ }
+ mArray[mSize] = null;
+ }
+ }
+ return old;
+ }
+
+ /**
+ * Return the number of items in this array map.
+ */
+ @Override
+ public int size() {
+ return mSize;
+ }
+
+ @Override
+ public Object[] toArray() {
+ Object[] result = new Object[mSize];
+ System.arraycopy(mArray, 0, result, 0, mSize);
+ return result;
+ }
+
+ @Override
+ public <T> T[] toArray(T[] array) {
+ if (array.length < mSize) {
+ @SuppressWarnings("unchecked") T[] newArray
+ = (T[]) Array.newInstance(array.getClass().getComponentType(), mSize);
+ array = newArray;
+ }
+ System.arraycopy(mArray, 0, array, 0, mSize);
+ if (array.length > mSize) {
+ array[mSize] = null;
+ }
+ return array;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * <p>This implementation returns false if the object is not a set, or
+ * if the sets have different sizes. Otherwise, for each value in this
+ * set, it checks to make sure the value also exists in the other set.
+ * If any value doesn't exist, the method returns false; otherwise, it
+ * returns true.
+ */
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof Set) {
+ Set<?> set = (Set<?>) object;
+ if (size() != set.size()) {
+ return false;
+ }
+
+ try {
+ for (int i=0; i<mSize; i++) {
+ E mine = valueAt(i);
+ if (!set.contains(mine)) {
+ return false;
+ }
+ }
+ } catch (NullPointerException ignored) {
+ return false;
+ } catch (ClassCastException ignored) {
+ return false;
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int hashCode() {
+ final int[] hashes = mHashes;
+ int result = 0;
+ for (int i = 0, s = mSize; i < s; i++) {
+ result += hashes[i];
+ }
+ return result;
+ }
+
+ // ------------------------------------------------------------------------
+ // Interop with traditional Java containers. Not as efficient as using
+ // specialized collection APIs.
+ // ------------------------------------------------------------------------
+
+ private MapCollections<E, E> getCollection() {
+ if (mCollections == null) {
+ mCollections = new MapCollections<E, E>() {
+ @Override
+ protected int colGetSize() {
+ return mSize;
+ }
+
+ @Override
+ protected Object colGetEntry(int index, int offset) {
+ return mArray[index];
+ }
+
+ @Override
+ protected int colIndexOfKey(Object key) {
+ return indexOf(key, key.hashCode());
+ }
+
+ @Override
+ protected int colIndexOfValue(Object value) {
+ return indexOf(value, value.hashCode());
+ }
+
+ @Override
+ protected Map<E, E> colGetMap() {
+ throw new UnsupportedOperationException("not a map");
+ }
+
+ @Override
+ protected void colPut(E key, E value) {
+ add(key);
+ }
+
+ @Override
+ protected E colSetValue(int index, E value) {
+ throw new UnsupportedOperationException("not a map");
+ }
+
+ @Override
+ protected void colRemoveAt(int index) {
+ removeAt(index);
+ }
+
+ @Override
+ protected void colClear() {
+ clear();
+ }
+ };
+ }
+ return mCollections;
+ }
+
+ @Override
+ public Iterator<E> iterator() {
+ return getCollection().getKeySet().iterator();
+ }
+
+ @Override
+ public boolean containsAll(Collection<?> collection) {
+ Iterator<?> it = collection.iterator();
+ while (it.hasNext()) {
+ if (!contains(it.next())) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public boolean addAll(Collection<? extends E> collection) {
+ ensureCapacity(mSize + collection.size());
+ boolean added = false;
+ for (E value : collection) {
+ added |= add(value);
+ }
+ return added;
+ }
+
+ @Override
+ public boolean removeAll(Collection<?> collection) {
+ boolean removed = false;
+ for (Object value : collection) {
+ removed |= remove(value);
+ }
+ return removed;
+ }
+
+ @Override
+ public boolean retainAll(Collection<?> collection) {
+ boolean removed = false;
+ for (int i=mSize-1; i>=0; i--) {
+ if (!collection.contains(mArray[i])) {
+ removeAt(i);
+ removed = true;
+ }
+ }
+ return removed;
+ }
+}
diff --git a/core/java/android/webkit/WebViewFactory.java b/core/java/android/webkit/WebViewFactory.java
index 00d87bd..7197c96 100644
--- a/core/java/android/webkit/WebViewFactory.java
+++ b/core/java/android/webkit/WebViewFactory.java
@@ -37,7 +37,6 @@
private static final String DEFAULT_WEBVIEW_FACTORY = "android.webkit.WebViewClassic$Factory";
private static final String CHROMIUM_WEBVIEW_FACTORY =
"com.android.webview.chromium.WebViewChromiumFactoryProvider";
- private static final String CHROMIUM_WEBVIEW_JAR = "/system/framework/webviewchromium.jar";
private static final String LOGTAG = "WebViewFactory";
@@ -49,7 +48,14 @@
private static final Object sProviderLock = new Object();
public static boolean isExperimentalWebViewAvailable() {
- return Build.IS_DEBUGGABLE && (new java.io.File(CHROMIUM_WEBVIEW_JAR).exists());
+ try {
+ // Pass false so we don't initialize the class at this point, as this will be wasted if
+ // it's not enabled.
+ Class.forName(CHROMIUM_WEBVIEW_FACTORY, false, WebViewFactory.class.getClassLoader());
+ return true;
+ } catch (ClassNotFoundException e) {
+ return false;
+ }
}
static WebViewFactoryProvider getProvider() {
@@ -61,7 +67,7 @@
if (isExperimentalWebViewEnabled()) {
StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
try {
- sProviderInstance = loadChromiumProvider();
+ sProviderInstance = getFactoryByName(CHROMIUM_WEBVIEW_FACTORY);
if (DEBUG) Log.v(LOGTAG, "Loaded Chromium provider: " + sProviderInstance);
} finally {
StrictMode.setThreadPolicy(oldPolicy);
@@ -71,8 +77,7 @@
if (sProviderInstance == null) {
if (DEBUG) Log.v(LOGTAG, "Falling back to default provider: "
+ DEFAULT_WEBVIEW_FACTORY);
- sProviderInstance = getFactoryByName(DEFAULT_WEBVIEW_FACTORY,
- WebViewFactory.class.getClassLoader());
+ sProviderInstance = getFactoryByName(DEFAULT_WEBVIEW_FACTORY);
if (sProviderInstance == null) {
if (DEBUG) Log.v(LOGTAG, "Falling back to explicit linkage");
sProviderInstance = new WebViewClassic.Factory();
@@ -96,19 +101,10 @@
return SystemProperties.getBoolean(WEBVIEW_EXPERIMENTAL_PROPERTY, false);
}
- // TODO: This allows us to have the legacy and Chromium WebView coexist for development
- // and side-by-side testing. After transition, remove this when no longer required.
- private static WebViewFactoryProvider loadChromiumProvider() {
- ClassLoader clazzLoader = new PathClassLoader(CHROMIUM_WEBVIEW_JAR, null,
- WebViewFactory.class.getClassLoader());
- return getFactoryByName(CHROMIUM_WEBVIEW_FACTORY, clazzLoader);
- }
-
- private static WebViewFactoryProvider getFactoryByName(String providerName,
- ClassLoader loader) {
+ private static WebViewFactoryProvider getFactoryByName(String providerName) {
try {
if (DEBUG) Log.v(LOGTAG, "attempt to load class " + providerName);
- Class<?> c = Class.forName(providerName, true, loader);
+ Class<?> c = Class.forName(providerName);
if (DEBUG) Log.v(LOGTAG, "instantiating factory");
return (WebViewFactoryProvider) c.newInstance();
} catch (ClassNotFoundException e) {
diff --git a/core/java/android/widget/FastScroller.java b/core/java/android/widget/FastScroller.java
index fc9c000..aa33384 100644
--- a/core/java/android/widget/FastScroller.java
+++ b/core/java/android/widget/FastScroller.java
@@ -18,6 +18,7 @@
import android.content.Context;
import android.content.res.ColorStateList;
+import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
@@ -37,12 +38,13 @@
*/
class FastScroller {
private static final String TAG = "FastScroller";
-
+
// Minimum number of pages to justify showing a fast scroll thumb
private static int MIN_PAGES = 4;
// Scroll thumb not showing
private static final int STATE_NONE = 0;
// Not implemented yet - fade-in transition
+ @SuppressWarnings("unused")
private static final int STATE_ENTER = 1;
// Scroll thumb visible and moving along with the scrollbar
private static final int STATE_VISIBLE = 2;
@@ -75,7 +77,7 @@
private static final int OVERLAY_FLOATING = 0;
private static final int OVERLAY_AT_THUMB = 1;
-
+
private Drawable mThumbDrawable;
private Drawable mOverlayDrawable;
private Drawable mTrackDrawable;
@@ -89,6 +91,7 @@
private RectF mOverlayPos;
private int mOverlaySize;
+ private int mOverlayPadding;
AbsListView mList;
boolean mScrollCompleted;
@@ -97,21 +100,21 @@
private int mListOffset;
private int mItemCount = -1;
private boolean mLongList;
-
+
private Object [] mSections;
private String mSectionText;
private boolean mDrawOverlay;
private ScrollFade mScrollFade;
-
+
private int mState;
-
+
private Handler mHandler = new Handler();
-
+
BaseAdapter mListAdapter;
private SectionIndexer mSectionIndexer;
private boolean mChangedBounds;
-
+
private int mPosition;
private boolean mAlwaysShow;
@@ -130,6 +133,7 @@
private final Rect mTmpRect = new Rect();
private final Runnable mDeferStartDrag = new Runnable() {
+ @Override
public void run() {
if (mList.mIsAttached) {
beginDrag();
@@ -237,11 +241,11 @@
mState = state;
refreshDrawableState();
}
-
+
public int getState() {
return mState;
}
-
+
private void resetThumbPos() {
final int viewWidth = mList.getWidth();
// Bounds are always top right. Y coordinate get's translated during draw
@@ -255,7 +259,7 @@
}
mThumbDrawable.setAlpha(ScrollFade.ALPHA_MAX);
}
-
+
private void useThumbDrawable(Context context, Drawable drawable) {
mThumbDrawable = drawable;
if (drawable instanceof NinePatchDrawable) {
@@ -272,20 +276,23 @@
private void init(Context context) {
// Get both the scrollbar states drawables
- TypedArray ta = context.getTheme().obtainStyledAttributes(ATTRS);
+ final TypedArray ta = context.getTheme().obtainStyledAttributes(ATTRS);
useThumbDrawable(context, ta.getDrawable(THUMB_DRAWABLE));
mTrackDrawable = ta.getDrawable(TRACK_DRAWABLE);
-
+
mOverlayDrawableLeft = ta.getDrawable(PREVIEW_BACKGROUND_LEFT);
mOverlayDrawableRight = ta.getDrawable(PREVIEW_BACKGROUND_RIGHT);
mOverlayPosition = ta.getInt(OVERLAY_POSITION, OVERLAY_FLOATING);
-
+
mScrollCompleted = true;
getSectionsFromIndexer();
- mOverlaySize = context.getResources().getDimensionPixelSize(
+ final Resources res = context.getResources();
+ mOverlaySize = res.getDimensionPixelSize(
com.android.internal.R.dimen.fastscroll_overlay_size);
+ mOverlayPadding = res.getDimensionPixelSize(
+ com.android.internal.R.dimen.fastscroll_overlay_padding);
mOverlayPos = new RectF();
mScrollFade = new ScrollFade();
mPaint = new Paint();
@@ -302,7 +309,7 @@
if (mList.getWidth() > 0 && mList.getHeight() > 0) {
onSizeChanged(mList.getWidth(), mList.getHeight(), 0, 0);
}
-
+
mState = STATE_NONE;
refreshDrawableState();
@@ -315,17 +322,17 @@
setScrollbarPosition(mList.getVerticalScrollbarPosition());
}
-
+
void stop() {
setState(STATE_NONE);
}
-
+
boolean isVisible() {
return !(mState == STATE_NONE);
}
-
+
public void draw(Canvas canvas) {
-
+
if (mState == STATE_NONE) {
// No need to draw anything
return;
@@ -371,44 +378,53 @@
// If user is dragging the scroll bar, draw the alphabet overlay
if (mState == STATE_DRAGGING && mDrawOverlay) {
- if (mOverlayPosition == OVERLAY_AT_THUMB) {
- int left = 0;
- switch (mPosition) {
- default:
- case View.SCROLLBAR_POSITION_RIGHT:
- left = Math.max(0,
- mThumbDrawable.getBounds().left - mThumbW - mOverlaySize);
- break;
- case View.SCROLLBAR_POSITION_LEFT:
- left = Math.min(mThumbDrawable.getBounds().right + mThumbW,
- mList.getWidth() - mOverlaySize);
- break;
- }
-
- int top = Math.max(0,
- Math.min(y + (mThumbH - mOverlaySize) / 2, mList.getHeight() - mOverlaySize));
-
- final RectF pos = mOverlayPos;
- pos.left = left;
- pos.right = pos.left + mOverlaySize;
- pos.top = top;
- pos.bottom = pos.top + mOverlaySize;
- if (mOverlayDrawable != null) {
- mOverlayDrawable.setBounds((int) pos.left, (int) pos.top,
- (int) pos.right, (int) pos.bottom);
- }
- }
- mOverlayDrawable.draw(canvas);
+ final Drawable overlay = mOverlayDrawable;
final Paint paint = mPaint;
- float descent = paint.descent();
- final RectF rectF = mOverlayPos;
+ final String sectionText = mSectionText;
final Rect tmpRect = mTmpRect;
- mOverlayDrawable.getPadding(tmpRect);
- final int hOff = (tmpRect.right - tmpRect.left) / 2;
- final int vOff = (tmpRect.bottom - tmpRect.top) / 2;
- canvas.drawText(mSectionText, (int) (rectF.left + rectF.right) / 2 - hOff,
- (int) (rectF.bottom + rectF.top) / 2 + mOverlaySize / 4 - descent - vOff,
- paint);
+
+ // TODO: Use a text view in an overlay for transition animations and
+ // handling of text overflow.
+ paint.getTextBounds(sectionText, 0, sectionText.length(), tmpRect);
+ final int textWidth = tmpRect.width();
+ final int textHeight = tmpRect.height();
+
+ overlay.getPadding(tmpRect);
+ final int overlayWidth = Math.max(
+ mOverlaySize, textWidth + tmpRect.left + tmpRect.right + mOverlayPadding * 2);
+ final int overlayHeight = Math.max(
+ mOverlaySize, textHeight + tmpRect.top + tmpRect.bottom + mOverlayPadding * 2);
+ final RectF pos = mOverlayPos;
+
+ if (mOverlayPosition == OVERLAY_AT_THUMB) {
+ final Rect thumbBounds = mThumbDrawable.getBounds();
+
+ switch (mPosition) {
+ case View.SCROLLBAR_POSITION_LEFT:
+ pos.left = Math.min(
+ thumbBounds.right + mThumbW, mList.getWidth() - overlayWidth);
+ break;
+ case View.SCROLLBAR_POSITION_RIGHT:
+ default:
+ pos.left = Math.max(0, thumbBounds.left - mThumbW - overlayWidth);
+ break;
+ }
+
+ pos.top = Math.max(0, Math.min(
+ y + (mThumbH - overlayHeight) / 2, mList.getHeight() - overlayHeight));
+ }
+
+ pos.right = pos.left + overlayWidth;
+ pos.bottom = pos.top + overlayHeight;
+
+ overlay.setBounds((int) pos.left, (int) pos.top, (int) pos.right, (int) pos.bottom);
+ overlay.draw(canvas);
+
+ final float hOff = (tmpRect.right - tmpRect.left) / 2.0f;
+ final float vOff = (tmpRect.bottom - tmpRect.top) / 2.0f;
+ final float cX = pos.centerX() - hOff;
+ final float cY = pos.centerY() + (overlayHeight / 4.0f) - paint.descent() - vOff;
+ canvas.drawText(mSectionText, cX, cY, paint);
} else if (mState == STATE_EXIT) {
if (alpha == 0) { // Done with exit
setState(STATE_NONE);
@@ -467,7 +483,7 @@
}
}
- void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount,
+ void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount,
int totalItemCount) {
// Are there enough pages to require fast scroll? Recompute only if total count changes
if (mItemCount != totalItemCount && visibleItemCount > 0) {
@@ -577,7 +593,7 @@
if (section < nSections - 1) {
nextIndex = mSectionIndexer.getPositionForSection(section + 1);
}
-
+
// Find the previous index if we're slicing the previous section
if (nextIndex == index) {
// Non-existent letter
@@ -597,9 +613,9 @@
}
}
// Find the next index, in case the assumed next index is not
- // unique. For instance, if there is no P, then request for P's
+ // unique. For instance, if there is no P, then request for P's
// position actually returns Q's. So we need to look ahead to make
- // sure that there is really a Q at Q's position. If not, move
+ // sure that there is really a Q at Q's position. If not, move
// further down...
int nextNextSection = nextSection + 1;
while (nextNextSection < nSections &&
@@ -609,18 +625,18 @@
}
// Compute the beginning and ending scroll range percentage of the
// currently visible letter. This could be equal to or greater than
- // (1 / nSections).
+ // (1 / nSections).
float fPrev = (float) prevSection / nSections;
float fNext = (float) nextSection / nSections;
if (prevSection == exactSection && position - fPrev < fThreshold) {
index = prevIndex;
} else {
- index = prevIndex + (int) ((nextIndex - prevIndex) * (position - fPrev)
+ index = prevIndex + (int) ((nextIndex - prevIndex) * (position - fPrev)
/ (fNext - fPrev));
}
// Don't overflow
if (index > count - 1) index = count - 1;
-
+
if (mList instanceof ExpandableListView) {
ExpandableListView expList = (ExpandableListView) mList;
expList.setSelectionFromTop(expList.getFlatListPosition(
@@ -705,7 +721,7 @@
mList.onTouchEvent(cancelFling);
cancelFling.recycle();
}
-
+
void cancelPendingDrag() {
mList.removeCallbacks(mDeferStartDrag);
mPendingDrag = false;
@@ -862,18 +878,18 @@
}
public class ScrollFade implements Runnable {
-
+
long mStartTime;
long mFadeDuration;
static final int ALPHA_MAX = 208;
static final long FADE_DURATION = 200;
-
+
void startFade() {
mFadeDuration = FADE_DURATION;
mStartTime = SystemClock.uptimeMillis();
setState(STATE_EXIT);
}
-
+
int getAlpha() {
if (getState() != STATE_EXIT) {
return ALPHA_MAX;
@@ -883,17 +899,18 @@
if (now > mStartTime + mFadeDuration) {
alpha = 0;
} else {
- alpha = (int) (ALPHA_MAX - ((now - mStartTime) * ALPHA_MAX) / mFadeDuration);
+ alpha = (int) (ALPHA_MAX - ((now - mStartTime) * ALPHA_MAX) / mFadeDuration);
}
return alpha;
}
-
+
+ @Override
public void run() {
if (getState() != STATE_EXIT) {
startFade();
return;
}
-
+
if (getAlpha() > 0) {
mList.invalidate();
} else {
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index 38a8c19..949a499 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -6038,7 +6038,7 @@
updateNetworkActivityLocked();
}
- public void dumpLocked(PrintWriter pw, boolean isUnpluggedOnly) {
+ public void dumpLocked(PrintWriter pw, boolean isUnpluggedOnly, int reqUid) {
if (DEBUG) {
Printer pr = new PrintWriterPrinter(pw);
pr.println("*** Screen timer:");
@@ -6068,6 +6068,6 @@
pr.println("*** Bluetooth timer:");
mBluetoothOnTimer.logState(pr, " ");
}
- super.dumpLocked(pw, isUnpluggedOnly);
+ super.dumpLocked(pw, isUnpluggedOnly, reqUid);
}
}
diff --git a/services/java/com/android/server/am/TransferPipe.java b/core/java/com/android/internal/os/TransferPipe.java
similarity index 94%
rename from services/java/com/android/server/am/TransferPipe.java
rename to core/java/com/android/internal/os/TransferPipe.java
index 055c577..068d914 100644
--- a/services/java/com/android/server/am/TransferPipe.java
+++ b/core/java/com/android/internal/os/TransferPipe.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.server.am;
+package com.android.internal.os;
import java.io.FileDescriptor;
import java.io.FileInputStream;
@@ -32,7 +32,7 @@
/**
* Helper for transferring data through a pipe from a client app.
*/
-final class TransferPipe implements Runnable {
+public final class TransferPipe implements Runnable {
static final String TAG = "TransferPipe";
static final boolean DEBUG = false;
@@ -53,7 +53,7 @@
String[] args) throws RemoteException;
}
- TransferPipe() throws IOException {
+ public TransferPipe() throws IOException {
mThread = new Thread(this, "TransferPipe");
mFds = ParcelFileDescriptor.createPipe();
}
@@ -62,11 +62,11 @@
return mFds[0];
}
- ParcelFileDescriptor getWriteFd() {
+ public ParcelFileDescriptor getWriteFd() {
return mFds[1];
}
- void setBufferPrefix(String prefix) {
+ public void setBufferPrefix(String prefix) {
mBufferPrefix = prefix;
}
@@ -120,11 +120,11 @@
}
}
- void go(FileDescriptor out) throws IOException {
+ public void go(FileDescriptor out) throws IOException {
go(out, DEFAULT_TIMEOUT);
}
- void go(FileDescriptor out, long timeout) throws IOException {
+ public void go(FileDescriptor out, long timeout) throws IOException {
try {
synchronized (this) {
mOutFd = out;
@@ -173,7 +173,7 @@
}
}
- void kill() {
+ public void kill() {
closeFd(0);
closeFd(1);
}
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 6918099..1643522 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -216,7 +216,8 @@
android:description="@string/permdesc_sendSms" />
<!-- Allows an application (Phone) to send a request to other applications
- to handle the respond-via-message action during incoming calls. -->
+ to handle the respond-via-message action during incoming calls.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.SEND_RESPOND_VIA_MESSAGE"
android:permissionGroup="android.permission-group.MESSAGES"
android:protectionLevel="signature|system"
@@ -240,7 +241,8 @@
android:description="@string/permdesc_receiveMms" />
<!-- Allows an application to receive emergency cell broadcast messages,
- to record or display them to the user. Reserved for system apps.
+ to record or display them to the user.
+ <p>Not for use by third-party applications.
@hide Pending API council approval -->
<permission android:name="android.permission.RECEIVE_EMERGENCY_BROADCAST"
android:permissionGroup="android.permission-group.MESSAGES"
@@ -319,7 +321,8 @@
android:description="@string/permdesc_writeContacts" />
<!-- Allows an application to execute contacts directory search.
- This should only be used by ContactsProvider. -->
+ This should only be used by ContactsProvider.
+ <p>Not for use by third-party applications. -->
<!-- @hide -->
<permission android:name="android.permission.BIND_DIRECTORY_SEARCH"
android:permissionGroup="android.permission-group.PERSONAL_INFO"
@@ -598,15 +601,16 @@
android:label="@string/permlab_accessLocationExtraCommands"
android:description="@string/permdesc_accessLocationExtraCommands" />
- <!-- Allows an application to install a location provider into the Location Manager -->
+ <!-- Allows an application to install a location provider into the Location Manager.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.INSTALL_LOCATION_PROVIDER"
android:protectionLevel="signature|system"
android:label="@string/permlab_installLocationProvider"
android:description="@string/permdesc_installLocationProvider" />
<!-- Allows an application to use location features in hardware,
- such as the geofencing api
- Protected by signature|system protection level -->
+ such as the geofencing api.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.LOCATION_HARDWARE"
android:permissionGroup="android.permission-group.LOCATION"
android:protectionLevel="signature|system" />
@@ -769,8 +773,8 @@
android:label="@string/permlab_manageAccounts"
android:description="@string/permdesc_manageAccounts" />
- <!-- Allows applications to call into AccountAuthenticators. Only
- the system can get this permission. -->
+ <!-- Allows applications to call into AccountAuthenticators.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.ACCOUNT_MANAGER"
android:permissionGroup="android.permission-group.ACCOUNTS"
android:protectionLevel="signature"
@@ -870,7 +874,8 @@
android:label="@string/permlab_accessMtp"
android:description="@string/permdesc_accessMtp" />
- <!-- Allows access to hardware peripherals. Intended only for hardware testing -->
+ <!-- Allows access to hardware peripherals. Intended only for hardware testing.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.HARDWARE_TEST"
android:permissionGroup="android.permission-group.HARDWARE_CONTROLS"
android:protectionLevel="signature"
@@ -971,7 +976,8 @@
android:description="@string/permdesc_processOutgoingCalls" />
<!-- Allows modification of the telephony state - power on, mmi, etc.
- Does not include placing calls. -->
+ Does not include placing calls.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.MODIFY_PHONE_STATE"
android:permissionGroup="android.permission-group.PHONE_CALLS"
android:protectionLevel="signature|system"
@@ -1265,7 +1271,8 @@
android:description="@string/permgroupdesc_systemClock"
android:priority="140" />
- <!-- Allows applications to set the system time -->
+ <!-- Allows applications to set the system time.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.SET_TIME"
android:protectionLevel="signature|system"
android:label="@string/permlab_setTime"
@@ -1378,7 +1385,8 @@
android:label="@string/permlab_writeSettings"
android:description="@string/permdesc_writeSettings" />
- <!-- Allows an application to modify the Google service map. -->
+ <!-- Allows an application to modify the Google service map.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.WRITE_GSERVICES"
android:protectionLevel="signature|system"
android:label="@string/permlab_writeGservices"
@@ -1401,7 +1409,8 @@
android:label="@string/permlab_retrieve_window_content"
android:description="@string/permdesc_retrieve_window_content" />
- <!-- Modify the global animation scaling factor. -->
+ <!-- Modify the global animation scaling factor.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.SET_ANIMATION_SCALE"
android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
android:protectionLevel="signature|system|development"
@@ -1459,14 +1468,16 @@
android:label="@string/permlab_broadcastSticky"
android:description="@string/permdesc_broadcastSticky" />
- <!-- Allows mounting and unmounting file systems for removable storage. -->
+ <!-- Allows mounting and unmounting file systems for removable storage.
+ <p>Not for use by third-party applications.-->
<permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"
android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
android:protectionLevel="system|signature"
android:label="@string/permlab_mount_unmount_filesystems"
android:description="@string/permdesc_mount_unmount_filesystems" />
- <!-- Allows formatting file systems for removable storage. -->
+ <!-- Allows formatting file systems for removable storage.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.MOUNT_FORMAT_FILESYSTEMS"
android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
android:protectionLevel="system|signature"
@@ -1513,7 +1524,8 @@
android:label="@string/permlab_asec_rename"
android:description="@string/permdesc_asec_rename" />
- <!-- Allows applications to write the apn settings -->
+ <!-- Allows applications to write the apn settings.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.WRITE_APN_SETTINGS"
android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
android:protectionLevel="signature|system"
@@ -1561,7 +1573,7 @@
<eat-comment />
<!-- Group of permissions that are related to development features. These
- are not permissions that should appear in normal applications; they
+ are not permissions that should appear in third-party applications; they
protect APIs that are intended only to be used for development
purposes. -->
<permission-group android:name="android.permission-group.DEVELOPMENT_TOOLS"
@@ -1569,15 +1581,16 @@
android:description="@string/permgroupdesc_developmentTools"
android:priority="310" />
- <!-- Allows an application to read or write the secure system settings. -->
+ <!-- Allows an application to read or write the secure system settings.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.WRITE_SECURE_SETTINGS"
android:permissionGroup="android.permission-group.DEVELOPMENT_TOOLS"
android:protectionLevel="signature|system|development"
android:label="@string/permlab_writeSecureSettings"
android:description="@string/permdesc_writeSecureSettings" />
- <!-- Allows an application to retrieve state dump information from system
- services. -->
+ <!-- Allows an application to retrieve state dump information from system services.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.DUMP"
android:permissionGroup="android.permission-group.DEVELOPMENT_TOOLS"
android:protectionLevel="signature|system|development"
@@ -1585,15 +1598,16 @@
android:description="@string/permdesc_dump" />
<!-- Allows an application to read the low-level system log files.
- Log entries can contain the user's private information,
- which is why this permission is not available to normal apps. -->
+ <p>Not for use by third-party applications, because
+ Log entries can contain the user's private information. -->
<permission android:name="android.permission.READ_LOGS"
android:permissionGroup="android.permission-group.DEVELOPMENT_TOOLS"
android:protectionLevel="signature|system|development"
android:label="@string/permlab_readLogs"
android:description="@string/permdesc_readLogs" />
- <!-- Configure an application for debugging. -->
+ <!-- Configure an application for debugging.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.SET_DEBUG_APP"
android:permissionGroup="android.permission-group.DEVELOPMENT_TOOLS"
android:protectionLevel="signature|system|development"
@@ -1601,7 +1615,8 @@
android:description="@string/permdesc_setDebugApp" />
<!-- Allows an application to set the maximum number of (not needed)
- application processes that can be running. -->
+ application processes that can be running.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.SET_PROCESS_LIMIT"
android:permissionGroup="android.permission-group.DEVELOPMENT_TOOLS"
android:protectionLevel="signature|system|development"
@@ -1609,14 +1624,16 @@
android:description="@string/permdesc_setProcessLimit" />
<!-- Allows an application to control whether activities are immediately
- finished when put in the background. -->
+ finished when put in the background.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.SET_ALWAYS_FINISH"
android:permissionGroup="android.permission-group.DEVELOPMENT_TOOLS"
android:protectionLevel="signature|system|development"
android:label="@string/permlab_setAlwaysFinish"
android:description="@string/permdesc_setAlwaysFinish" />
- <!-- Allow an application to request that a signal be sent to all persistent processes -->
+ <!-- Allow an application to request that a signal be sent to all persistent processes.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.SIGNAL_PERSISTENT_PROCESSES"
android:permissionGroup="android.permission-group.DEVELOPMENT_TOOLS"
android:protectionLevel="signature|system|development"
@@ -1628,7 +1645,8 @@
<!-- ==================================== -->
<eat-comment />
- <!-- Allows applications to RW to diagnostic resources. -->
+ <!-- Allows applications to RW to diagnostic resources.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.DIAGNOSTIC"
android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
android:protectionLevel="signature"
@@ -1636,7 +1654,8 @@
android:label="@string/permlab_diagnostic" />
<!-- Allows an application to open, close, or disable the status bar
- and its icons. -->
+ and its icons.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.STATUS_BAR"
android:label="@string/permlab_statusBar"
android:description="@string/permdesc_statusBar"
@@ -1650,14 +1669,15 @@
android:protectionLevel="signature" />
<!-- Allows an application to force a BACK operation on whatever is the
- top activity. -->
+ top activity.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.FORCE_BACK"
android:label="@string/permlab_forceBack"
android:description="@string/permdesc_forceBack"
android:protectionLevel="signature" />
- <!-- Allows an application to update device statistics. Not for
- use by third party apps. -->
+ <!-- Allows an application to update device statistics.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.UPDATE_DEVICE_STATS"
android:label="@string/permlab_updateBatteryStats"
android:description="@string/permdesc_updateBatteryStats"
@@ -1678,15 +1698,16 @@
android:protectionLevel="signature|system" />
<!-- Allows an application to open windows that are for use by parts
- of the system user interface. Not for use by third party apps. -->
+ of the system user interface.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.INTERNAL_SYSTEM_WINDOW"
android:label="@string/permlab_internalSystemWindow"
android:description="@string/permdesc_internalSystemWindow"
android:protectionLevel="signature" />
<!-- Allows an application to manage (create, destroy,
- Z-order) application tokens in the window manager. This is only
- for use by the system. -->
+ Z-order) application tokens in the window manager.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.MANAGE_APP_TOKENS"
android:label="@string/permlab_manageAppTokens"
android:description="@string/permdesc_manageAppTokens"
@@ -1702,7 +1723,7 @@
<!-- Allows an application to inject user events (keys, touch, trackball)
into the event stream and deliver them to ANY window. Without this
permission, you can only deliver events to windows in your own process.
- Very few applications should need to use this permission. -->
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.INJECT_EVENTS"
android:label="@string/permlab_injectEvents"
android:description="@string/permdesc_injectEvents"
@@ -1735,7 +1756,8 @@
<!-- Allows an application to watch and control how activities are
started globally in the system. Only for is in debugging
- (usually the monkey command). -->
+ (usually the monkey command).
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.SET_ACTIVITY_WATCHER"
android:label="@string/permlab_runSetActivityWatcher"
android:description="@string/permdesc_runSetActivityWatcher"
@@ -1760,14 +1782,16 @@
android:protectionLevel="signature|system" />
<!-- Allows an application to retrieve private information about
- the current top activity, such as any assist context it can provide. -->
+ the current top activity, such as any assist context it can provide.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.GET_TOP_ACTIVITY_INFO"
android:label="@string/permlab_getTopActivityInfo"
android:description="@string/permdesc_getTopActivityInfo"
android:protectionLevel="signature" />
<!-- Allows an application to retrieve the current state of keys and
- switches. This is only for use by the system.
+ switches.
+ <p>Not for use by third-party applications.
@deprecated The API that used this permission has been removed. -->
<permission android:name="android.permission.READ_INPUT_STATE"
android:label="@string/permlab_readInputState"
@@ -1817,46 +1841,51 @@
android:protectionLevel="signature" />
<!-- Allows low-level access to setting the orientation (actually
- rotation) of the screen. Not for use by normal applications. -->
+ rotation) of the screen.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.SET_ORIENTATION"
android:label="@string/permlab_setOrientation"
android:description="@string/permdesc_setOrientation"
android:protectionLevel="signature" />
<!-- Allows low-level access to setting the pointer speed.
- Not for use by normal applications. -->
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.SET_POINTER_SPEED"
android:label="@string/permlab_setPointerSpeed"
android:description="@string/permdesc_setPointerSpeed"
android:protectionLevel="signature" />
<!-- Allows low-level access to setting the keyboard layout.
- Not for use by normal applications.
+ <p>Not for use by third-party applications.
@hide -->
<permission android:name="android.permission.SET_KEYBOARD_LAYOUT"
android:label="@string/permlab_setKeyboardLayout"
android:description="@string/permdesc_setKeyboardLayout"
android:protectionLevel="signature" />
- <!-- Allows an application to install packages. -->
+ <!-- Allows an application to install packages.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.INSTALL_PACKAGES"
android:label="@string/permlab_installPackages"
android:description="@string/permdesc_installPackages"
android:protectionLevel="signature|system" />
- <!-- Allows an application to clear user data -->
+ <!-- Allows an application to clear user data.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.CLEAR_APP_USER_DATA"
android:label="@string/permlab_clearAppUserData"
android:description="@string/permdesc_clearAppUserData"
android:protectionLevel="signature" />
- <!-- Allows an application to delete cache files. -->
+ <!-- Allows an application to delete cache files.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.DELETE_CACHE_FILES"
android:label="@string/permlab_deleteCacheFiles"
android:description="@string/permdesc_deleteCacheFiles"
android:protectionLevel="signature|system" />
- <!-- Allows an application to delete packages. -->
+ <!-- Allows an application to delete packages.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.DELETE_PACKAGES"
android:label="@string/permlab_deletePackages"
android:description="@string/permdesc_deletePackages"
@@ -1870,7 +1899,8 @@
android:protectionLevel="signature|system" />
<!-- Allows an application to change whether an application component (other than its own) is
- enabled or not. -->
+ enabled or not.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.CHANGE_COMPONENT_ENABLED_STATE"
android:label="@string/permlab_changeComponentState"
android:description="@string/permdesc_changeComponentState"
@@ -1882,14 +1912,16 @@
android:description="@string/permdesc_grantRevokePermissions"
android:protectionLevel="signature" />
- <!-- Allows an application to use SurfaceFlinger's low level features -->
+ <!-- Allows an application to use SurfaceFlinger's low level features.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.ACCESS_SURFACE_FLINGER"
android:label="@string/permlab_accessSurfaceFlinger"
android:description="@string/permdesc_accessSurfaceFlinger"
android:protectionLevel="signature" />
<!-- Allows an application to take screen shots and more generally
- get access to the frame buffer data -->
+ get access to the frame buffer data.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.READ_FRAME_BUFFER"
android:label="@string/permlab_readFrameBuffer"
android:description="@string/permdesc_readFrameBuffer"
@@ -1911,19 +1943,22 @@
android:description="@string/permdesc_controlWifiDisplay"
android:protectionLevel="signature" />
- <!-- Required to be able to disable the device (very dangerous!). -->
+ <!-- Required to be able to disable the device (very dangerous!).
+ <p>Not for use by third-party applications.. -->
<permission android:name="android.permission.BRICK"
android:label="@string/permlab_brick"
android:description="@string/permdesc_brick"
android:protectionLevel="signature" />
- <!-- Required to be able to reboot the device. -->
+ <!-- Required to be able to reboot the device.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.REBOOT"
android:label="@string/permlab_reboot"
android:description="@string/permdesc_reboot"
android:protectionLevel="signature|system" />
- <!-- Allows low-level access to power management -->
+ <!-- Allows low-level access to power management.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.DEVICE_POWER"
android:label="@string/permlab_devicePower"
android:description="@string/permdesc_devicePower"
@@ -1935,34 +1970,39 @@
android:protectionLevel="signature" />
<!-- Run as a manufacturer test application, running as the root user.
- Only available when the device is running in manufacturer test mode. -->
+ Only available when the device is running in manufacturer test mode.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.FACTORY_TEST"
android:label="@string/permlab_factoryTest"
android:description="@string/permdesc_factoryTest"
android:protectionLevel="signature" />
<!-- Allows an application to broadcast a notification that an application
- package has been removed. -->
+ package has been removed.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.BROADCAST_PACKAGE_REMOVED"
android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
android:label="@string/permlab_broadcastPackageRemoved"
android:description="@string/permdesc_broadcastPackageRemoved"
android:protectionLevel="signature" />
- <!-- Allows an application to broadcast an SMS receipt notification -->
+ <!-- Allows an application to broadcast an SMS receipt notification.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.BROADCAST_SMS"
android:permissionGroup="android.permission-group.MESSAGES"
android:label="@string/permlab_broadcastSmsReceived"
android:description="@string/permdesc_broadcastSmsReceived"
android:protectionLevel="signature" />
- <!-- Allows an application to broadcast a WAP PUSH receipt notification -->
+ <!-- Allows an application to broadcast a WAP PUSH receipt notification.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.BROADCAST_WAP_PUSH"
android:permissionGroup="android.permission-group.MESSAGES"
android:label="@string/permlab_broadcastWapPush"
android:description="@string/permdesc_broadcastWapPush"
android:protectionLevel="signature" />
+ <!-- Not for use by third-party applications. -->
<permission android:name="android.permission.MASTER_CLEAR"
android:label="@string/permlab_masterClear"
android:description="@string/permdesc_masterClear"
@@ -1970,7 +2010,8 @@
<!-- Allows an application to call any phone number, including emergency
numbers, without going through the Dialer user interface for the user
- to confirm the call being placed. Not for use by third party apps. -->
+ to confirm the call being placed.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.CALL_PRIVILEGED"
android:label="@string/permlab_callPrivileged"
android:description="@string/permdesc_callPrivileged"
@@ -1983,14 +2024,16 @@
android:protectionLevel="signature|system" />
<!-- Allows enabling/disabling location update notifications from
- the radio. Not for use by normal applications. -->
+ the radio.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.CONTROL_LOCATION_UPDATES"
android:label="@string/permlab_locationUpdates"
android:description="@string/permdesc_locationUpdates"
android:protectionLevel="signature|system" />
<!-- Allows read/write access to the "properties" table in the checkin
- database, to change values that get uploaded. -->
+ database, to change values that get uploaded.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.ACCESS_CHECKIN_PROPERTIES"
android:label="@string/permlab_checkinProperties"
android:description="@string/permdesc_checkinProperties"
@@ -2010,7 +2053,8 @@
android:description="@string/permdesc_batteryStats"
android:protectionLevel="dangerous" />
- <!-- Allows an application to control the backup and restore process
+ <!-- Allows an application to control the backup and restore process.
+ <p>Not for use by third-party applications.
@hide pending API council -->
<permission android:name="android.permission.BACKUP"
android:label="@string/permlab_backup"
@@ -2037,7 +2081,7 @@
picks an AppWidget to go into a particular host, thereby giving that
host application access to the private data from the AppWidget app.
An application that has this permission should honor that contract.
- Very few applications should need to use this permission. -->
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.BIND_APPWIDGET"
android:permissionGroup="android.permission-group.PERSONAL_INFO"
android:label="@string/permlab_bindGadget"
@@ -2058,7 +2102,8 @@
android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
android:protectionLevel="signature|system" />
- <!-- Allows applications to change the background data setting
+ <!-- Allows applications to change the background data setting.
+ <p>Not for use by third-party applications.
@hide pending API council -->
<permission android:name="android.permission.CHANGE_BACKGROUND_DATA_SETTING"
android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index 637128a5..ccca2d8 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -50,8 +50,10 @@
<!-- Margin at the edge of the screen to ignore touch events for in the windowshade. -->
<dimen name="status_bar_edge_ignore">5dp</dimen>
- <!-- Size of the fastscroll hint letter -->
+ <!-- Minimum size of the fastscroll overlay -->
<dimen name="fastscroll_overlay_size">104dp</dimen>
+ <!-- Padding of the fastscroll overlay -->
+ <dimen name="fastscroll_overlay_padding">16dp</dimen>
<!-- Width of the fastscroll thumb -->
<dimen name="fastscroll_thumb_width">64dp</dimen>
<!-- Height of the fastscroll thumb -->
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 089a859..36a7a86 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -2046,6 +2046,7 @@
<public type="attr" name="canRequestTouchExplorationMode" id="0x010103d7" />
<public type="attr" name="canRequestEnhancedWebAccessibility" id="0x010103d8" />
<public type="attr" name="canRequestFilterKeyEvents" id="0x010103d9" />
+ <public type="attr" name="layoutMode" id="0x010103da" />
<public type="style" name="Theme.Holo.NoActionBar.Overscan" id="0x010301dd" />
<public type="style" name="Theme.Holo.Light.NoActionBar.Overscan" id="0x010301de" />
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 3718220..d33a6fa 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -309,9 +309,9 @@
<java-symbol type="dimen" name="dropdownitem_icon_width" />
<java-symbol type="dimen" name="dropdownitem_text_padding_left" />
<java-symbol type="dimen" name="fastscroll_overlay_size" />
+ <java-symbol type="dimen" name="fastscroll_overlay_padding" />
<java-symbol type="dimen" name="fastscroll_thumb_height" />
<java-symbol type="dimen" name="fastscroll_thumb_width" />
- <java-symbol type="dimen" name="fastscroll_thumb_width" />
<java-symbol type="dimen" name="password_keyboard_spacebar_vertical_correction" />
<java-symbol type="dimen" name="search_view_preferred_width" />
<java-symbol type="dimen" name="textview_error_popup_default_width" />
diff --git a/docs/html/tools/extras/support-library.jd b/docs/html/tools/extras/support-library.jd
index 60168f4..a82a98a 100644
--- a/docs/html/tools/extras/support-library.jd
+++ b/docs/html/tools/extras/support-library.jd
@@ -18,8 +18,7 @@
<h2>See also</h2>
<ol>
<li><a
-href="{@docRoot}guide/practices/optimizing-for-3.0.html">Optimizing Apps for Android 3.0</a></li>
- <li><a href="http://code.google.com/p/iosched/">Google I/O App source code</a></li>
+href="{@docRoot}training/basics/fragments/support-lib.html">Using the Support Library</a></li>
</ol>
</div>
@@ -708,8 +707,8 @@
</div>
<p>For more information about how you can optimize your application for the latest
-Android-powered devices, read <a href="{@docRoot}guide/practices/optimizing-for-3.0.html">Optimizing
-Apps for Android 3.0</a>.</p>
+Android-powered devices, read <a href="{@docRoot}guide/practices/tablets-and-handsets.html"
+>Supporting Tablets and Handsets</a>.</p>
<h2 id="Docs">Reference Docs</h2>
diff --git a/docs/html/training/basics/data-storage/databases.jd b/docs/html/training/basics/data-storage/databases.jd
index 61fb758..6ea2140 100644
--- a/docs/html/training/basics/data-storage/databases.jd
+++ b/docs/html/training/basics/data-storage/databases.jd
@@ -73,25 +73,23 @@
<pre>
-public static abstract class FeedEntry implements BaseColumns {
- public static final String TABLE_NAME = "entry";
- public static final String COLUMN_NAME_ENTRY_ID = "entryid";
- public static final String COLUMN_NAME_TITLE = "title";
- public static final String COLUMN_NAME_SUBTITLE = "subtitle";
- ...
+public final class FeedReaderContract {
+ // To prevent someone from accidentally instantiating the contract class,
+ // give it an empty constructor.
+ public FeedReaderContract() {}
+
+ /* Inner class that defines the table contents */
+ public static abstract class FeedEntry implements BaseColumns {
+ public static final String TABLE_NAME = "entry";
+ public static final String COLUMN_NAME_ENTRY_ID = "entryid";
+ public static final String COLUMN_NAME_TITLE = "title";
+ public static final String COLUMN_NAME_SUBTITLE = "subtitle";
+ ...
+ }
}
</pre>
-<p>To prevent someone from accidentally instantiating the contract class, give
-it an empty constructor. </p>
-
-<pre>
-// Prevents the FeedReaderContract class from being instantiated.
-private FeedReaderContract() {}
-</pre>
-
-
<h2 id="DbHelper">Create a Database Using a SQL Helper</h2>
@@ -103,15 +101,15 @@
private static final String TEXT_TYPE = " TEXT";
private static final String COMMA_SEP = ",";
private static final String SQL_CREATE_ENTRIES =
- "CREATE TABLE " + FeedReaderContract.FeedEntry.TABLE_NAME + " (" +
- FeedReaderContract.FeedEntry._ID + " INTEGER PRIMARY KEY," +
- FeedReaderContract.FeedEntry.COLUMN_NAME_ENTRY_ID + TEXT_TYPE + COMMA_SEP +
- FeedReaderContract.FeedEntry.COLUMN_NAME_TITLE + TEXT_TYPE + COMMA_SEP +
+ "CREATE TABLE " + FeedEntry.TABLE_NAME + " (" +
+ FeedEntry._ID + " INTEGER PRIMARY KEY," +
+ FeedEntry.COLUMN_NAME_ENTRY_ID + TEXT_TYPE + COMMA_SEP +
+ FeedEntry.COLUMN_NAME_TITLE + TEXT_TYPE + COMMA_SEP +
... // Any other options for the CREATE command
" )";
private static final String SQL_DELETE_ENTRIES =
- "DROP TABLE IF EXISTS " + TABLE_NAME_ENTRIES;
+ "DROP TABLE IF EXISTS " + FeedEntry.TABLE_NAME;
</pre>
<p>Just like files that you save on the device's <a
@@ -191,15 +189,15 @@
// Create a new map of values, where column names are the keys
ContentValues values = new ContentValues();
-values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_ENTRY_ID, id);
-values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_TITLE, title);
-values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CONTENT, content);
+values.put(FeedEntry.COLUMN_NAME_ENTRY_ID, id);
+values.put(FeedEntry.COLUMN_NAME_TITLE, title);
+values.put(FeedEntry.COLUMN_NAME_CONTENT, content);
// Insert the new row, returning the primary key value of the new row
long newRowId;
newRowId = db.insert(
- FeedReaderContract.FeedEntry.TABLE_NAME,
- FeedReaderContract.FeedEntry.COLUMN_NAME_NULLABLE,
+ FeedEntry.TABLE_NAME,
+ FeedEntry.COLUMN_NAME_NULLABLE,
values);
</pre>
@@ -227,18 +225,18 @@
// Define a <em>projection</em> that specifies which columns from the database
// you will actually use after this query.
String[] projection = {
- FeedReaderContract.FeedEntry._ID,
- FeedReaderContract.FeedEntry.COLUMN_NAME_TITLE,
- FeedReaderContract.FeedEntry.COLUMN_NAME_UPDATED,
+ FeedEntry._ID,
+ FeedEntry.COLUMN_NAME_TITLE,
+ FeedEntry.COLUMN_NAME_UPDATED,
...
};
// How you want the results sorted in the resulting Cursor
String sortOrder =
- FeedReaderContract.FeedEntry.COLUMN_NAME_UPDATED + " DESC";
+ FeedEntry.COLUMN_NAME_UPDATED + " DESC";
Cursor c = db.query(
- FeedReaderContract.FeedEntry.TABLE_NAME, // The table to query
+ FeedEntry.TABLE_NAME, // The table to query
projection, // The columns to return
selection, // The columns for the WHERE clause
selectionArgs, // The values for the WHERE clause
@@ -262,7 +260,7 @@
<pre>
cursor.moveToFirst();
long itemId = cursor.getLong(
- cursor.getColumnIndexOrThrow(FeedReaderContract.FeedEntry._ID)
+ cursor.getColumnIndexOrThrow(FeedEntry._ID)
);
</pre>
@@ -282,7 +280,7 @@
<pre>
// Define 'where' part of query.
-String selection = FeedReaderContract.FeedEntry.COLUMN_NAME_ENTRY_ID + " LIKE ?";
+String selection = FeedEntry.COLUMN_NAME_ENTRY_ID + " LIKE ?";
// Specify arguments in placeholder order.
String[] selectionArgs = { String.valueOf(rowId) };
// Issue SQL statement.
@@ -305,10 +303,10 @@
// New value for one column
ContentValues values = new ContentValues();
-values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_TITLE, title);
+values.put(FeedEntry.COLUMN_NAME_TITLE, title);
// Which row to update, based on the ID
-String selection = FeedReaderContract.FeedEntry.COLUMN_NAME_ENTRY_ID + " LIKE ?";
+String selection = FeedEntry.COLUMN_NAME_ENTRY_ID + " LIKE ?";
String[] selectionArgs = { String.valueOf(rowId) };
int count = db.update(
diff --git a/libs/hwui/DisplayList.cpp b/libs/hwui/DisplayList.cpp
index 06209f1..b2d9915 100644
--- a/libs/hwui/DisplayList.cpp
+++ b/libs/hwui/DisplayList.cpp
@@ -63,6 +63,7 @@
void DisplayList::clearResources() {
mDisplayListData = NULL;
+ mSize = 0; // TODO: shouldn't be needed, WAR possible use after delete
mClipRectOp = NULL;
mSaveLayerOp = NULL;
@@ -479,7 +480,7 @@
*/
template <class T>
void DisplayList::iterate(OpenGLRenderer& renderer, T& handler, const int level) {
- if (mSize == 0 || mAlpha <= 0) {
+ if (mSize == 0 || mAlpha <= 0 || CC_UNLIKELY(!mSaveOp)) { // TODO: shouldn't need mSaveOp check
DISPLAY_LIST_LOGD("%*sEmpty display list (%p, %s)", level * 2, "", this, mName.string());
return;
}
diff --git a/libs/hwui/DisplayListOp.h b/libs/hwui/DisplayListOp.h
index 6839b18..028decd 100644
--- a/libs/hwui/DisplayListOp.h
+++ b/libs/hwui/DisplayListOp.h
@@ -932,13 +932,22 @@
DrawPatchOp(SkBitmap* bitmap, Res_png_9patch* patch,
float left, float top, float right, float bottom, int alpha, SkXfermode::Mode mode)
: DrawBoundedOp(left, top, right, bottom, 0),
- mBitmap(bitmap), mPatch(patch), mAlpha(alpha), mMode(mode) {
+ mBitmap(bitmap), mPatch(patch), mAlpha(alpha), mMode(mode),
+ mGenerationId(0), mMesh(NULL) {
mEntry = Caches::getInstance().assetAtlas.getEntry(bitmap);
};
virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
- // NOTE: not calling the virtual method, which takes a paint
- return renderer.drawPatch(mBitmap, mPatch, mEntry, mLocalBounds.left, mLocalBounds.top,
+ if (!mMesh || renderer.getCaches().patchCache.getGenerationId() != mGenerationId) {
+ PatchCache& cache = renderer.getCaches().patchCache;
+ mMesh = cache.get(mEntry, mBitmap->width(), mBitmap->height(),
+ mLocalBounds.right - mLocalBounds.left, mLocalBounds.bottom - mLocalBounds.top,
+ mPatch);
+ mGenerationId = cache.getGenerationId();
+ }
+ // We're not calling the public variant of drawPatch() here
+ // This method won't perform the quickReject() since we've already done it at this point
+ return renderer.drawPatch(mBitmap, mMesh, mEntry, mLocalBounds.left, mLocalBounds.top,
mLocalBounds.right, mLocalBounds.bottom, mAlpha, mMode);
}
@@ -957,8 +966,12 @@
private:
SkBitmap* mBitmap;
Res_png_9patch* mPatch;
+
int mAlpha;
SkXfermode::Mode mMode;
+
+ uint32_t mGenerationId;
+ const Patch* mMesh;
AssetAtlas::Entry* mEntry;
};
diff --git a/libs/hwui/LayerRenderer.cpp b/libs/hwui/LayerRenderer.cpp
index 79e0b0c..cfb1e97e 100644
--- a/libs/hwui/LayerRenderer.cpp
+++ b/libs/hwui/LayerRenderer.cpp
@@ -467,7 +467,7 @@
mat4 texTransform(layer->getTexTransform());
mat4 invert;
- invert.translate(0.0f, 1.0f, 0.0f);
+ invert.translate(0.0f, 1.0f);
invert.scale(1.0f, -1.0f, 1.0f);
layer->getTexTransform().multiply(invert);
diff --git a/libs/hwui/Matrix.h b/libs/hwui/Matrix.h
index 75e280c..df744be 100644
--- a/libs/hwui/Matrix.h
+++ b/libs/hwui/Matrix.h
@@ -128,10 +128,27 @@
void multiply(float v);
- void translate(float x, float y, float z) {
- Matrix4 u;
- u.loadTranslate(x, y, z);
- multiply(u);
+ void translate(float x, float y) {
+ if ((getType() & sGeometryMask) == kTypeTranslate) {
+ data[kTranslateX] += x;
+ data[kTranslateY] += y;
+ } else {
+ // Doing a translation will only affect the translate bit of the type
+ // Save the type
+ uint32_t type = mType;
+
+ Matrix4 u;
+ u.loadTranslate(x, y, 0.0f);
+ multiply(u);
+
+ // Restore the type and fix the translate bit
+ mType = type;
+ if (data[kTranslateX] != 0.0f || data[kTranslateY] != 0.0f) {
+ mType |= kTypeTranslate;
+ } else {
+ mType &= ~kTypeTranslate;
+ }
+ }
}
void scale(float sx, float sy, float sz) {
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index f5343b1..d95a62c 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -1407,7 +1407,7 @@
///////////////////////////////////////////////////////////////////////////////
void OpenGLRenderer::translate(float dx, float dy) {
- currentTransform().translate(dx, dy, 0.0f);
+ currentTransform().translate(dx, dy);
}
void OpenGLRenderer::rotate(float degrees) {
@@ -2337,20 +2337,25 @@
SkXfermode::Mode mode;
getAlphaAndMode(paint, &alpha, &mode);
- return drawPatch(bitmap, patch, mCaches.assetAtlas.getEntry(bitmap),
- left, top, right, bottom, alpha, mode);
-}
-
-status_t OpenGLRenderer::drawPatch(SkBitmap* bitmap, Res_png_9patch* patch,
- AssetAtlas::Entry* entry, float left, float top, float right, float bottom,
- int alpha, SkXfermode::Mode mode) {
if (quickReject(left, top, right, bottom)) {
return DrawGlInfo::kStatusDone;
}
+ AssetAtlas::Entry* entry = mCaches.assetAtlas.getEntry(bitmap);
const Patch* mesh = mCaches.patchCache.get(entry, bitmap->width(), bitmap->height(),
right - left, bottom - top, patch);
+ return drawPatch(bitmap, mesh, entry, left, top, right, bottom, alpha, mode);
+}
+
+status_t OpenGLRenderer::drawPatch(SkBitmap* bitmap, const Patch* mesh,
+ AssetAtlas::Entry* entry, float left, float top, float right, float bottom,
+ int alpha, SkXfermode::Mode mode) {
+
+ if (quickReject(left, top, right, bottom)) {
+ return DrawGlInfo::kStatusDone;
+ }
+
if (CC_LIKELY(mesh && mesh->verticesCount > 0)) {
mCaches.activeTexture(0);
Texture* texture = entry ? entry->texture : mCaches.textureCache.get(bitmap);
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h
index e9ea2f32..ce4ce42 100644
--- a/libs/hwui/OpenGLRenderer.h
+++ b/libs/hwui/OpenGLRenderer.h
@@ -266,7 +266,7 @@
float* vertices, int* colors, SkPaint* paint);
virtual status_t drawPatch(SkBitmap* bitmap, Res_png_9patch* patch,
float left, float top, float right, float bottom, SkPaint* paint);
- status_t drawPatch(SkBitmap* bitmap, Res_png_9patch* patch, AssetAtlas::Entry* entry,
+ status_t drawPatch(SkBitmap* bitmap, const Patch* mesh, AssetAtlas::Entry* entry,
float left, float top, float right, float bottom, int alpha, SkXfermode::Mode mode);
virtual status_t drawColor(int color, SkXfermode::Mode mode);
virtual status_t drawRect(float left, float top, float right, float bottom, SkPaint* paint);
diff --git a/libs/hwui/PatchCache.cpp b/libs/hwui/PatchCache.cpp
index c6ed275..c23e991 100644
--- a/libs/hwui/PatchCache.cpp
+++ b/libs/hwui/PatchCache.cpp
@@ -30,7 +30,9 @@
// Constructors/destructor
///////////////////////////////////////////////////////////////////////////////
-PatchCache::PatchCache(): mCache(LruCache<PatchDescription, Patch*>::kUnlimitedCapacity) {
+PatchCache::PatchCache():
+ mSize(0), mCache(LruCache<PatchDescription, Patch*>::kUnlimitedCapacity),
+ mMeshBuffer(0), mGenerationId(0) {
char property[PROPERTY_VALUE_MAX];
if (property_get(PROPERTY_PATCH_CACHE_SIZE, property, NULL) > 0) {
INIT_LOGD(" Setting patch cache size to %skB", property);
@@ -39,8 +41,6 @@
INIT_LOGD(" Using default patch cache size of %.2fkB", DEFAULT_PATCH_CACHE_SIZE);
mMaxSize = KB(DEFAULT_PATCH_CACHE_SIZE);
}
- mSize = 0;
- mMeshBuffer = 0;
}
PatchCache::~PatchCache() {
@@ -58,7 +58,7 @@
caches.resetVertexPointers();
if (created) {
- glBufferData(GL_ARRAY_BUFFER, mMaxSize, NULL, GL_DYNAMIC_DRAW);
+ createVertexBuffer();
}
}
@@ -99,6 +99,12 @@
mCache.clear();
}
+void PatchCache::createVertexBuffer() {
+ glBufferData(GL_ARRAY_BUFFER, mMaxSize, NULL, GL_DYNAMIC_DRAW);
+ mSize = 0;
+ mGenerationId++;
+}
+
const Patch* PatchCache::get(const AssetAtlas::Entry* entry,
const uint32_t bitmapWidth, const uint32_t bitmapHeight,
const float pixelWidth, const float pixelHeight, const Res_png_9patch* patch) {
@@ -127,8 +133,7 @@
uint32_t size = newMesh->getSize();
if (mSize + size > mMaxSize) {
clearCache();
- glBufferData(GL_ARRAY_BUFFER, mMaxSize, NULL, GL_DYNAMIC_DRAW);
- mSize = 0;
+ createVertexBuffer();
}
newMesh->offset = (GLintptr) mSize;
diff --git a/libs/hwui/PatchCache.h b/libs/hwui/PatchCache.h
index 530dad0..1829b89 100644
--- a/libs/hwui/PatchCache.h
+++ b/libs/hwui/PatchCache.h
@@ -70,8 +70,13 @@
return mMeshBuffer;
}
+ uint32_t getGenerationId() const {
+ return mGenerationId;
+ }
+
private:
void clearCache();
+ void createVertexBuffer();
struct PatchDescription {
PatchDescription(): mPatch(NULL), mBitmapWidth(0), mBitmapHeight(0),
@@ -122,9 +127,11 @@
uint32_t mMaxSize;
uint32_t mSize;
+ LruCache<PatchDescription, Patch*> mCache;
+
GLuint mMeshBuffer;
- LruCache<PatchDescription, Patch*> mCache;
+ uint32_t mGenerationId;
}; // class PatchCache
}; // namespace uirenderer
diff --git a/libs/hwui/Program.cpp b/libs/hwui/Program.cpp
index c127d68..9e4670e 100644
--- a/libs/hwui/Program.cpp
+++ b/libs/hwui/Program.cpp
@@ -172,7 +172,7 @@
// up and to the left.
// This offset value is based on an assumption that some hardware may use as
// little as 12.4 precision, so we offset by slightly more than 1/16.
- p.translate(.065, .065, 0);
+ p.translate(.065, .065);
glUniformMatrix4fv(projection, 1, GL_FALSE, &p.data[0]);
}
mProjection = projectionMatrix;
diff --git a/media/java/android/media/IRemoteControlDisplay.aidl b/media/java/android/media/IRemoteControlDisplay.aidl
index c70889c..583f436 100644
--- a/media/java/android/media/IRemoteControlDisplay.aidl
+++ b/media/java/android/media/IRemoteControlDisplay.aidl
@@ -40,6 +40,33 @@
void setCurrentClientId(int clientGeneration, in PendingIntent clientMediaIntent,
boolean clearing);
+ /**
+ * Sets the playback information (state, position and speed) of a client.
+ * @param generationId the current generation ID as known by this client
+ * @param state the current playback state, one of the following values:
+ * {@link RemoteControlClient#PLAYSTATE_STOPPED},
+ * {@link RemoteControlClient#PLAYSTATE_PAUSED},
+ * {@link RemoteControlClient#PLAYSTATE_PLAYING},
+ * {@link RemoteControlClient#PLAYSTATE_FAST_FORWARDING},
+ * {@link RemoteControlClient#PLAYSTATE_REWINDING},
+ * {@link RemoteControlClient#PLAYSTATE_SKIPPING_FORWARDS},
+ * {@link RemoteControlClient#PLAYSTATE_SKIPPING_BACKWARDS},
+ * {@link RemoteControlClient#PLAYSTATE_BUFFERING},
+ * {@link RemoteControlClient#PLAYSTATE_ERROR}.
+ * @param stateChangeTimeMs the time at which the client reported the playback information
+ * @param currentPosMs a 0 or positive value for the current media position expressed in ms
+ * Strictly negative values imply that position is not known:
+ * a value of {@link RemoteControlClient#PLAYBACK_POSITION_INVALID} is intended to express
+ * that an application doesn't know the position (e.g. listening to a live stream of a radio)
+ * or that the position information is not applicable (e.g. when state
+ * is {@link RemoteControlClient#PLAYSTATE_BUFFERING} and nothing had played yet);
+ * a value of {@link RemoteControlClient#PLAYBACK_POSITION_ALWAYS_UNKNOWN} implies that the
+ * application uses {@link RemoteControlClient#setPlaybackState(int)} (legacy API) and will
+ * never pass a playback position.
+ * @param speed a value expressed as a ratio of 1x playback: 1.0f is normal playback,
+ * 2.0f is 2x, 0.5f is half-speed, -2.0f is rewind at 2x speed. 0.0f means nothing is
+ * playing (e.g. when state is {@link RemoteControlClient#PLAYSTATE_ERROR}).
+ */
void setPlaybackState(int generationId, int state, long stateChangeTimeMs, long currentPosMs,
float speed);
diff --git a/media/java/android/media/MediaExtractor.java b/media/java/android/media/MediaExtractor.java
index cf159f0..e558c07 100644
--- a/media/java/android/media/MediaExtractor.java
+++ b/media/java/android/media/MediaExtractor.java
@@ -199,9 +199,9 @@
public native final int getTrackCount();
/**
- * Get the PSSH info if present. This returns a map of uuid-to-bytes, with the uuid specifying
+ * Get the PSSH info if present.
+ * @return a map of uuid-to-bytes, with the uuid specifying
* the crypto scheme, and the bytes being the data specific to that scheme.
- * {@hide}
*/
public Map<UUID, byte[]> getPsshInfo() {
Map<UUID, byte[]> psshMap = null;
diff --git a/media/java/android/media/RemoteControlClient.java b/media/java/android/media/RemoteControlClient.java
index c6ae9aa..7379438 100644
--- a/media/java/android/media/RemoteControlClient.java
+++ b/media/java/android/media/RemoteControlClient.java
@@ -180,6 +180,12 @@
public final static long PLAYBACK_POSITION_INVALID = -1;
/**
* @hide
+ * An invalid playback position value associated with the use of {@link #setPlaybackState(int)}
+ * used to indicate that playback position will remain unknown.
+ */
+ public final static long PLAYBACK_POSITION_ALWAYS_UNKNOWN = 0x8019771980198300L;
+ /**
+ * @hide
* The default playback speed, 1x.
*/
public final static float PLAYBACK_SPEED_1X = 1.0f;
@@ -602,7 +608,8 @@
* {@link #PLAYSTATE_ERROR}.
*/
public void setPlaybackState(int state) {
- setPlaybackState(state, PLAYBACK_POSITION_INVALID, PLAYBACK_SPEED_1X);
+ setPlaybackStateInt(state, PLAYBACK_POSITION_ALWAYS_UNKNOWN, PLAYBACK_SPEED_1X,
+ false /* legacy API, converting to method with position and speed */);
}
/**
@@ -629,12 +636,28 @@
* playing (e.g. when state is {@link #PLAYSTATE_ERROR}).
*/
public void setPlaybackState(int state, long timeInMs, float playbackSpeed) {
+ setPlaybackStateInt(state, timeInMs, playbackSpeed, true);
+ }
+
+ private void setPlaybackStateInt(int state, long timeInMs, float playbackSpeed,
+ boolean hasPosition) {
synchronized(mCacheLock) {
if ((mPlaybackState != state) || (mPlaybackPositionMs != timeInMs)
|| (mPlaybackSpeed != playbackSpeed)) {
// store locally
mPlaybackState = state;
- mPlaybackPositionMs = timeInMs;
+ // distinguish between an application not knowing the current playback position
+ // at the moment and an application using the API where only the playback state
+ // is passed, not the playback position.
+ if (hasPosition) {
+ if (timeInMs < 0) {
+ mPlaybackPositionMs = PLAYBACK_POSITION_INVALID;
+ } else {
+ mPlaybackPositionMs = timeInMs;
+ }
+ } else {
+ mPlaybackPositionMs = PLAYBACK_POSITION_ALWAYS_UNKNOWN;
+ }
mPlaybackSpeed = playbackSpeed;
// keep track of when the state change occurred
mPlaybackStateChangeTimeMs = SystemClock.elapsedRealtime();
diff --git a/media/tests/MediaFrameworkTest/AndroidManifest.xml b/media/tests/MediaFrameworkTest/AndroidManifest.xml
index b698705..91ee2c6 100644
--- a/media/tests/MediaFrameworkTest/AndroidManifest.xml
+++ b/media/tests/MediaFrameworkTest/AndroidManifest.xml
@@ -71,4 +71,9 @@
android:label="Media Power tests InstrumentationRunner">
</instrumentation>
+ <instrumentation android:name=".MediaFrameworkIntegrationTestRunner"
+ android:targetPackage="com.android.mediaframeworktest"
+ android:label="MediaFramework integration tests InstrumentationRunner">
+ </instrumentation>
+
</manifest>
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkIntegrationTestRunner.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkIntegrationTestRunner.java
new file mode 100644
index 0000000..88c5b0c
--- /dev/null
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkIntegrationTestRunner.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.mediaframeworktest;
+
+import android.os.Bundle;
+import android.test.InstrumentationTestRunner;
+import android.test.InstrumentationTestSuite;
+
+import com.android.mediaframeworktest.integration.CameraBinderTest;
+
+import junit.framework.TestSuite;
+
+/**
+ * Instrumentation Test Runner for all media framework integration tests.
+ *
+ * Running all tests:
+ *
+ * adb shell am instrument -w com.android.mediaframeworktest/.MediaFrameworkIntegrationTestRunner
+ */
+
+public class MediaFrameworkIntegrationTestRunner extends InstrumentationTestRunner {
+
+
+ @Override
+ public TestSuite getAllTests() {
+ TestSuite suite = new InstrumentationTestSuite(this);
+ suite.addTestSuite(CameraBinderTest.class);
+ return suite;
+ }
+
+ @Override
+ public ClassLoader getLoader() {
+ return MediaFrameworkIntegrationTestRunner.class.getClassLoader();
+ }
+
+ @Override
+ public void onCreate(Bundle icicle) {
+ super.onCreate(icicle);
+ }
+}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTestRunner.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTestRunner.java
index 92ac9eb..cbb6642 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTestRunner.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTestRunner.java
@@ -50,7 +50,7 @@
* Running all tests:
*
* adb shell am instrument \
- * -w com.android.smstests.MediaPlayerInstrumentationTestRunner
+ * -w com.android.mediaframeworktest/.MediaFrameworkTestRunner
*/
public class MediaFrameworkTestRunner extends InstrumentationTestRunner {
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/CameraTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/CameraTest.java
index 2f864d7..7f23ba5 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/CameraTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/CameraTest.java
@@ -36,7 +36,12 @@
/**
* Junit / Instrumentation test case for the camera api
-
+ *
+ * To run only tests in this class:
+ *
+ * adb shell am instrument \
+ * -e class com.android.mediaframeworktest.functional.CameraTest \
+ * -w com.android.mediaframeworktest/.MediaFrameworkTestRunner
*/
public class CameraTest extends ActivityInstrumentationTestCase<MediaFrameworkTest> {
private String TAG = "CameraTest";
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/integration/CameraBinderTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/integration/CameraBinderTest.java
new file mode 100644
index 0000000..ba2859b
--- /dev/null
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/integration/CameraBinderTest.java
@@ -0,0 +1,225 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.mediaframeworktest.integration;
+
+import android.content.Context;
+import android.content.pm.FeatureInfo;
+import android.content.pm.PackageManager;
+import android.hardware.CameraInfo;
+import android.hardware.ICamera;
+import android.hardware.ICameraClient;
+import android.hardware.ICameraService;
+import android.hardware.ICameraServiceListener;
+import android.hardware.IProCameraCallbacks;
+import android.hardware.IProCameraUser;
+import android.os.Binder;
+import android.os.IBinder;
+import android.os.RemoteException;
+import android.os.ServiceManager;
+import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.SmallTest;
+import android.util.Log;
+
+/**
+ * Junit / Instrumentation test case for the camera2 api
+ *
+ * To run only tests in
+ * this class:
+ *
+ * adb shell am instrument \
+ * -e class com.android.mediaframeworktest.integration.CameraBinderTest \
+ * -w com.android.mediaframeworktest/.MediaFrameworkIntegrationTestRunner
+ */
+public class CameraBinderTest extends AndroidTestCase {
+ private static String TAG = "CameraBinderTest";
+
+ private static final String CAMERA_SERVICE_BINDER_NAME = "media.camera";
+ private static final int NO_ERROR = 0;
+ private static final int ALREADY_EXISTS = -17;
+ private static final int BAD_VALUE = -22;
+
+ private static final int USE_CALLING_UID = -1;
+
+ private ICameraService mCameraService;
+ private int mGuessedNumCameras = 0;
+
+ public CameraBinderTest() {
+ }
+
+ private final static boolean isFeatureAvailable(Context context, String feature) {
+ final PackageManager packageManager = context.getPackageManager();
+ final FeatureInfo[] featuresList = packageManager.getSystemAvailableFeatures();
+ for (FeatureInfo f : featuresList) {
+ if (f.name != null && f.name.equals(feature)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ // Guess the lower bound for how many cameras there are
+ private void guessNumCameras() {
+
+ /**
+ * Why do we need this? This way we have no dependency on getNumCameras
+ * actually working. On most systems there are only 0, 1, or 2 cameras,
+ * and this covers that 'usual case'. On other systems there might be 3+
+ * cameras, but this will at least check the first 2.
+ */
+ mGuessedNumCameras = 0;
+
+ // Front facing camera
+ if (isFeatureAvailable(getContext(), PackageManager.FEATURE_CAMERA_FRONT)) {
+ mGuessedNumCameras++;
+ }
+
+ // Back facing camera
+ if (isFeatureAvailable(getContext(), PackageManager.FEATURE_CAMERA)) {
+ mGuessedNumCameras++;
+ }
+
+ // Any facing camera
+ if (mGuessedNumCameras == 0
+ && isFeatureAvailable(getContext(), PackageManager.FEATURE_CAMERA_ANY)) {
+ mGuessedNumCameras++;
+ }
+
+ Log.v(TAG, "Guessing there are at least " + mGuessedNumCameras + " cameras");
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ guessNumCameras();
+
+ IBinder cameraServiceBinder = ServiceManager.getService(CAMERA_SERVICE_BINDER_NAME);
+ assertNotNull("Camera service IBinder should not be null", cameraServiceBinder);
+
+ mCameraService = ICameraService.Stub.asInterface(cameraServiceBinder);
+ assertNotNull("Camera service should not be null", mCameraService);
+ }
+
+ @SmallTest
+ public void testNumberOfCameras() throws Exception {
+ int numCameras = mCameraService.getNumberOfCameras();
+ assertTrue("At least this many cameras: " + mGuessedNumCameras,
+ numCameras >= mGuessedNumCameras);
+ Log.v(TAG, "Number of cameras " + numCameras);
+ }
+
+ @SmallTest
+ public void testCameraInfo() throws Exception {
+ for (int cameraId = 0; cameraId < mGuessedNumCameras; ++cameraId) {
+
+ CameraInfo info = new CameraInfo();
+ info.info.facing = -1;
+ info.info.orientation = -1;
+
+ assertTrue("Camera service returned info for camera " + cameraId,
+ mCameraService.getCameraInfo(cameraId, info) == NO_ERROR);
+ assertTrue("Facing was not set for camera " + cameraId, info.info.facing != -1);
+ assertTrue("Orientation was not set for camera " + cameraId,
+ info.info.orientation != -1);
+
+ Log.v(TAG, "Camera " + cameraId + " info: facing " + info.info.facing
+ + ", orientation " + info.info.orientation);
+ }
+ }
+
+ static abstract class DummyBase extends Binder implements android.os.IInterface {
+ @Override
+ public IBinder asBinder() {
+ return this;
+ }
+ }
+
+ static class DummyCameraClient extends DummyBase implements ICameraClient {
+ }
+
+ @SmallTest
+ public void testConnect() throws Exception {
+ for (int cameraId = 0; cameraId < mGuessedNumCameras; ++cameraId) {
+
+ ICameraClient dummyCallbacks = new DummyCameraClient();
+
+ String clientPackageName = getContext().getPackageName();
+
+ ICamera cameraUser = mCameraService.connect(dummyCallbacks, cameraId, clientPackageName,
+ USE_CALLING_UID);
+ assertNotNull(String.format("Camera %s was null", cameraId), cameraUser);
+
+ Log.v(TAG, String.format("Camera %s connected", cameraId));
+
+ cameraUser.disconnect();
+ }
+ }
+
+ static class DummyProCameraCallbacks extends DummyBase implements IProCameraCallbacks {
+ }
+
+ @SmallTest
+ public void testConnectPro() throws Exception {
+ for (int cameraId = 0; cameraId < mGuessedNumCameras; ++cameraId) {
+
+ IProCameraCallbacks dummyCallbacks = new DummyProCameraCallbacks();
+
+ String clientPackageName = getContext().getPackageName();
+
+ IProCameraUser cameraUser = mCameraService.connectPro(dummyCallbacks, cameraId,
+ clientPackageName, USE_CALLING_UID);
+ assertNotNull(String.format("Camera %s was null", cameraId), cameraUser);
+
+ Log.v(TAG, String.format("Camera %s connected", cameraId));
+
+ cameraUser.disconnect();
+ }
+ }
+
+ static class DummyCameraServiceListener extends DummyBase implements ICameraServiceListener {
+ @Override
+ public void onStatusChanged(int status, int cameraId)
+ throws RemoteException {
+ Log.v(TAG, String.format("Camera %d has status changed to 0x%x", cameraId, status));
+ }
+ }
+
+ /**
+ * adb shell am instrument \
+ * -e class 'com.android.mediaframeworktest.integration.CameraBinderTest#testAddRemoveListeners' \
+ * -w com.android.mediaframeworktest/.MediaFrameworkIntegrationTestRunner
+ */
+ @SmallTest
+ public void testAddRemoveListeners() throws Exception {
+ for (int cameraId = 0; cameraId < mGuessedNumCameras; ++cameraId) {
+
+ ICameraServiceListener listener = new DummyCameraServiceListener();
+
+ assertTrue("Listener was removed before added",
+ mCameraService.removeListener(listener) == BAD_VALUE);
+
+ assertTrue("Listener was not added", mCameraService.addListener(listener) == NO_ERROR);
+ assertTrue("Listener was wrongly added again",
+ mCameraService.addListener(listener) == ALREADY_EXISTS);
+
+ assertTrue("Listener was not removed",
+ mCameraService.removeListener(listener) == NO_ERROR);
+ assertTrue("Listener was wrongly removed again",
+ mCameraService.removeListener(listener) == BAD_VALUE);
+ }
+ }
+}
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java
index 0b85e70..3f04470 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java
@@ -20,6 +20,7 @@
import android.app.backup.BackupDataInput;
import android.app.backup.BackupDataOutput;
import android.app.backup.FullBackupDataOutput;
+import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
@@ -330,7 +331,16 @@
if (DEBUG_BACKUP) {
Log.v(TAG, "Starting deferred restore of wifi data");
}
+ final ContentResolver cr = getContentResolver();
+ final int scanAlways = Settings.Global.getInt(cr,
+ Settings.Global.WIFI_SCAN_ALWAYS_AVAILABLE, 0);
final int retainedWifiState = enableWifi(false);
+ if (scanAlways != 0) {
+ Settings.Global.putInt(cr,
+ Settings.Global.WIFI_SCAN_ALWAYS_AVAILABLE, 0);
+ // !!! Give the wifi stack a moment to quiesce
+ try { Thread.sleep(1000); } catch (InterruptedException e) {}
+ }
if (restoredSupplicantData != null) {
restoreWifiSupplicant(FILE_WIFI_SUPPLICANT,
restoredSupplicantData, restoredSupplicantData.length);
@@ -344,6 +354,10 @@
restoredWifiConfigFile, restoredWifiConfigFile.length);
}
// restore the previous WIFI state.
+ if (scanAlways != 0) {
+ Settings.Global.putInt(cr,
+ Settings.Global.WIFI_SCAN_ALWAYS_AVAILABLE, scanAlways);
+ }
enableWifi(retainedWifiState == WifiManager.WIFI_STATE_ENABLED ||
retainedWifiState == WifiManager.WIFI_STATE_ENABLING);
}
diff --git a/packages/SystemUI/res/drawable-hdpi/ic_qs_signal_full_lte.png b/packages/SystemUI/res/drawable-hdpi/ic_qs_signal_full_lte.png
new file mode 100644
index 0000000..1a5a8aa
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/ic_qs_signal_full_lte.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/ic_qs_signal_lte.png b/packages/SystemUI/res/drawable-hdpi/ic_qs_signal_lte.png
new file mode 100644
index 0000000..cceab0a
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/ic_qs_signal_lte.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/stat_sys_data_connected_lte.png b/packages/SystemUI/res/drawable-hdpi/stat_sys_data_connected_lte.png
new file mode 100644
index 0000000..e377608
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/stat_sys_data_connected_lte.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/stat_sys_data_fully_connected_lte.png b/packages/SystemUI/res/drawable-hdpi/stat_sys_data_fully_connected_lte.png
new file mode 100644
index 0000000..d619f6b
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/stat_sys_data_fully_connected_lte.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-ldrtl-hdpi/ic_qs_signal_full_lte.png b/packages/SystemUI/res/drawable-ldrtl-hdpi/ic_qs_signal_full_lte.png
new file mode 100644
index 0000000..515788a
--- /dev/null
+++ b/packages/SystemUI/res/drawable-ldrtl-hdpi/ic_qs_signal_full_lte.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-ldrtl-hdpi/ic_qs_signal_lte.png b/packages/SystemUI/res/drawable-ldrtl-hdpi/ic_qs_signal_lte.png
new file mode 100644
index 0000000..58327c1
--- /dev/null
+++ b/packages/SystemUI/res/drawable-ldrtl-hdpi/ic_qs_signal_lte.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-ldrtl-hdpi/stat_sys_data_connected_lte.png b/packages/SystemUI/res/drawable-ldrtl-hdpi/stat_sys_data_connected_lte.png
new file mode 100644
index 0000000..66dc694
--- /dev/null
+++ b/packages/SystemUI/res/drawable-ldrtl-hdpi/stat_sys_data_connected_lte.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-ldrtl-hdpi/stat_sys_data_fully_connected_lte.png b/packages/SystemUI/res/drawable-ldrtl-hdpi/stat_sys_data_fully_connected_lte.png
new file mode 100644
index 0000000..8078424
--- /dev/null
+++ b/packages/SystemUI/res/drawable-ldrtl-hdpi/stat_sys_data_fully_connected_lte.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-ldrtl-mdpi/ic_qs_signal_full_lte.png b/packages/SystemUI/res/drawable-ldrtl-mdpi/ic_qs_signal_full_lte.png
new file mode 100644
index 0000000..50e5011
--- /dev/null
+++ b/packages/SystemUI/res/drawable-ldrtl-mdpi/ic_qs_signal_full_lte.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-ldrtl-mdpi/ic_qs_signal_lte.png b/packages/SystemUI/res/drawable-ldrtl-mdpi/ic_qs_signal_lte.png
new file mode 100644
index 0000000..bb1de06
--- /dev/null
+++ b/packages/SystemUI/res/drawable-ldrtl-mdpi/ic_qs_signal_lte.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-ldrtl-mdpi/stat_sys_data_connected_lte.png b/packages/SystemUI/res/drawable-ldrtl-mdpi/stat_sys_data_connected_lte.png
new file mode 100644
index 0000000..6de14dc
--- /dev/null
+++ b/packages/SystemUI/res/drawable-ldrtl-mdpi/stat_sys_data_connected_lte.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-ldrtl-mdpi/stat_sys_data_fully_connected_lte.png b/packages/SystemUI/res/drawable-ldrtl-mdpi/stat_sys_data_fully_connected_lte.png
new file mode 100644
index 0000000..17ca21a
--- /dev/null
+++ b/packages/SystemUI/res/drawable-ldrtl-mdpi/stat_sys_data_fully_connected_lte.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-ldrtl-xhdpi/ic_qs_signal_full_lte.png b/packages/SystemUI/res/drawable-ldrtl-xhdpi/ic_qs_signal_full_lte.png
new file mode 100644
index 0000000..0d344b9
--- /dev/null
+++ b/packages/SystemUI/res/drawable-ldrtl-xhdpi/ic_qs_signal_full_lte.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-ldrtl-xhdpi/ic_qs_signal_lte.png b/packages/SystemUI/res/drawable-ldrtl-xhdpi/ic_qs_signal_lte.png
new file mode 100644
index 0000000..ac010bf
--- /dev/null
+++ b/packages/SystemUI/res/drawable-ldrtl-xhdpi/ic_qs_signal_lte.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-ldrtl-xhdpi/stat_sys_data_connected_lte.png b/packages/SystemUI/res/drawable-ldrtl-xhdpi/stat_sys_data_connected_lte.png
new file mode 100644
index 0000000..b704cdf
--- /dev/null
+++ b/packages/SystemUI/res/drawable-ldrtl-xhdpi/stat_sys_data_connected_lte.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-ldrtl-xhdpi/stat_sys_data_fully_connected_lte.png b/packages/SystemUI/res/drawable-ldrtl-xhdpi/stat_sys_data_fully_connected_lte.png
new file mode 100644
index 0000000..3cb8f3e
--- /dev/null
+++ b/packages/SystemUI/res/drawable-ldrtl-xhdpi/stat_sys_data_fully_connected_lte.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/ic_qs_signal_full_lte.png b/packages/SystemUI/res/drawable-mdpi/ic_qs_signal_full_lte.png
new file mode 100644
index 0000000..d819f5c
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/ic_qs_signal_full_lte.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/ic_qs_signal_lte.png b/packages/SystemUI/res/drawable-mdpi/ic_qs_signal_lte.png
new file mode 100644
index 0000000..bb1de06
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/ic_qs_signal_lte.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/stat_sys_data_connected_lte.png b/packages/SystemUI/res/drawable-mdpi/stat_sys_data_connected_lte.png
new file mode 100644
index 0000000..6de14dc
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/stat_sys_data_connected_lte.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/stat_sys_data_fully_connected_lte.png b/packages/SystemUI/res/drawable-mdpi/stat_sys_data_fully_connected_lte.png
new file mode 100644
index 0000000..17ca21a
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/stat_sys_data_fully_connected_lte.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_qs_signal_full_lte.png b/packages/SystemUI/res/drawable-xhdpi/ic_qs_signal_full_lte.png
new file mode 100644
index 0000000..75c5c72
--- /dev/null
+++ b/packages/SystemUI/res/drawable-xhdpi/ic_qs_signal_full_lte.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_qs_signal_lte.png b/packages/SystemUI/res/drawable-xhdpi/ic_qs_signal_lte.png
new file mode 100644
index 0000000..402db43
--- /dev/null
+++ b/packages/SystemUI/res/drawable-xhdpi/ic_qs_signal_lte.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/stat_sys_data_connected_lte.png b/packages/SystemUI/res/drawable-xhdpi/stat_sys_data_connected_lte.png
new file mode 100644
index 0000000..7a59975
--- /dev/null
+++ b/packages/SystemUI/res/drawable-xhdpi/stat_sys_data_connected_lte.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/stat_sys_data_fully_connected_lte.png b/packages/SystemUI/res/drawable-xhdpi/stat_sys_data_fully_connected_lte.png
new file mode 100644
index 0000000..84348ad
--- /dev/null
+++ b/packages/SystemUI/res/drawable-xhdpi/stat_sys_data_fully_connected_lte.png
Binary files differ
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index a27630d..4c81c88 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -102,5 +102,8 @@
<!-- Enable the "flip settings" panel -->
<bool name="config_hasFlipSettingsPanel">true</bool>
+
+ <!-- Should "4G" be shown instead of "LTE" when the network is NETWORK_TYPE_LTE? -->
+ <bool name="config_show4GForLTE">false</bool>
</resources>
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 5e232f3..9498fe4 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -320,6 +320,9 @@
<!-- Content description of the data connection type 4G for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_data_connection_4g">4G</string>
+ <!-- Content description of the data connection type LTE for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
+ <string name="accessibility_data_connection_lte">LTE</string>
+
<!-- Content description of the data connection type CDMA for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_data_connection_cdma">CDMA</string>
diff --git a/packages/SystemUI/src/com/android/systemui/BeanBag.java b/packages/SystemUI/src/com/android/systemui/BeanBag.java
index f5a90ca..a396759 100644
--- a/packages/SystemUI/src/com/android/systemui/BeanBag.java
+++ b/packages/SystemUI/src/com/android/systemui/BeanBag.java
@@ -16,44 +16,25 @@
package com.android.systemui;
-import android.animation.AnimatorSet;
-import android.animation.PropertyValuesHolder;
-import android.animation.ObjectAnimator;
import android.animation.TimeAnimator;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
-import android.content.Intent;
import android.content.pm.PackageManager;
-import android.graphics.drawable.AnimationDrawable;
-import android.graphics.drawable.BitmapDrawable;
import android.graphics.Bitmap;
import android.graphics.Canvas;
-import android.graphics.Color;
import android.graphics.ColorMatrix;
import android.graphics.ColorMatrixColorFilter;
-import android.graphics.Matrix;
import android.graphics.Paint;
-import android.graphics.Point;
-import android.graphics.PorterDuffColorFilter;
-import android.graphics.PorterDuffXfermode;
-import android.graphics.Rect;
-import android.graphics.RectF;
-import android.os.Handler;
-import android.os.SystemClock;
-import android.provider.Settings;
+import android.graphics.drawable.BitmapDrawable;
import android.util.AttributeSet;
-import android.util.DisplayMetrics;
-import android.util.Pair;
-import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
-import android.view.animation.AnimationUtils;
import android.widget.FrameLayout;
import android.widget.ImageView;
-import java.util.HashMap;
+
import java.util.Random;
public class BeanBag extends Activity {
diff --git a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
index 0019c1b..fa1e3fe 100644
--- a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
@@ -29,9 +29,9 @@
import android.view.ScaleGestureDetector;
import android.view.ScaleGestureDetector.OnScaleGestureListener;
import android.view.View;
+import android.view.View.OnClickListener;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
-import android.view.View.OnClickListener;
public class ExpandHelper implements Gefingerpoken, OnClickListener {
public interface Callback {
diff --git a/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java b/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java
index cdd3d84..ca6a06f 100644
--- a/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java
+++ b/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java
@@ -16,6 +16,9 @@
package com.android.systemui;
+import static android.opengl.GLES20.*;
+import static javax.microedition.khronos.egl.EGL10.*;
+
import android.app.ActivityManager;
import android.app.WallpaperManager;
import android.content.BroadcastReceiver;
@@ -35,18 +38,16 @@
import android.view.SurfaceHolder;
import android.view.WindowManager;
-import javax.microedition.khronos.egl.EGL10;
-import javax.microedition.khronos.egl.EGLConfig;
-import javax.microedition.khronos.egl.EGLContext;
-import javax.microedition.khronos.egl.EGLDisplay;
-import javax.microedition.khronos.egl.EGLSurface;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
-import static android.opengl.GLES20.*;
-import static javax.microedition.khronos.egl.EGL10.*;
+import javax.microedition.khronos.egl.EGL10;
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.egl.EGLContext;
+import javax.microedition.khronos.egl.EGLDisplay;
+import javax.microedition.khronos.egl.EGLSurface;
/**
* Default built-in wallpaper that simply shows a static image.
diff --git a/packages/SystemUI/src/com/android/systemui/LoadAverageService.java b/packages/SystemUI/src/com/android/systemui/LoadAverageService.java
index 2b45ad1..37e974b 100644
--- a/packages/SystemUI/src/com/android/systemui/LoadAverageService.java
+++ b/packages/SystemUI/src/com/android/systemui/LoadAverageService.java
@@ -16,8 +16,6 @@
package com.android.systemui;
-import com.android.internal.os.ProcessStats;
-
import android.app.Service;
import android.content.Context;
import android.content.Intent;
@@ -31,6 +29,8 @@
import android.view.View;
import android.view.WindowManager;
+import com.android.internal.os.ProcessStats;
+
public class LoadAverageService extends Service {
private View mView;
diff --git a/packages/SystemUI/src/com/android/systemui/SearchPanelView.java b/packages/SystemUI/src/com/android/systemui/SearchPanelView.java
index ab11748..7eec8f2 100644
--- a/packages/SystemUI/src/com/android/systemui/SearchPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/SearchPanelView.java
@@ -43,9 +43,6 @@
import com.android.internal.widget.multiwaveview.GlowPadView;
import com.android.internal.widget.multiwaveview.GlowPadView.OnTriggerListener;
-
-import com.android.systemui.EventLogTags;
-import com.android.systemui.R;
import com.android.systemui.recent.StatusBarTouchProxy;
import com.android.systemui.statusbar.BaseStatusBar;
import com.android.systemui.statusbar.CommandQueue;
diff --git a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
index f824a8e..d38d828 100644
--- a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
@@ -19,18 +19,17 @@
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
-import android.animation.Animator.AnimatorListener;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.graphics.RectF;
import android.os.Handler;
import android.util.Log;
-import android.view.accessibility.AccessibilityEvent;
-import android.view.animation.LinearInterpolator;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
+import android.view.accessibility.AccessibilityEvent;
+import android.view.animation.LinearInterpolator;
public class SwipeHelper implements Gefingerpoken {
static final String TAG = "com.android.systemui.SwipeHelper";
diff --git a/packages/SystemUI/src/com/android/systemui/SystemUI.java b/packages/SystemUI/src/com/android/systemui/SystemUI.java
index 2110483c..6c38cea 100644
--- a/packages/SystemUI/src/com/android/systemui/SystemUI.java
+++ b/packages/SystemUI/src/com/android/systemui/SystemUI.java
@@ -16,12 +16,12 @@
package com.android.systemui;
-import java.io.FileDescriptor;
-import java.io.PrintWriter;
-
import android.content.Context;
import android.content.res.Configuration;
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
+
public abstract class SystemUI {
public Context mContext;
diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIService.java b/packages/SystemUI/src/com/android/systemui/SystemUIService.java
index ebd7fa8..447161d 100644
--- a/packages/SystemUI/src/com/android/systemui/SystemUIService.java
+++ b/packages/SystemUI/src/com/android/systemui/SystemUIService.java
@@ -16,9 +16,6 @@
package com.android.systemui;
-import java.io.FileDescriptor;
-import java.io.PrintWriter;
-
import android.app.Service;
import android.content.Intent;
import android.content.res.Configuration;
@@ -28,6 +25,9 @@
import android.view.IWindowManager;
import android.view.WindowManagerGlobal;
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
+
public class SystemUIService extends Service {
static final String TAG = "SystemUIService";
diff --git a/packages/SystemUI/src/com/android/systemui/media/NotificationPlayer.java b/packages/SystemUI/src/com/android/systemui/media/NotificationPlayer.java
index 8979fc2..f8b347c 100644
--- a/packages/SystemUI/src/com/android/systemui/media/NotificationPlayer.java
+++ b/packages/SystemUI/src/com/android/systemui/media/NotificationPlayer.java
@@ -26,7 +26,6 @@
import android.os.SystemClock;
import android.util.Log;
-import java.lang.Thread;
import java.util.LinkedList;
/**
diff --git a/packages/SystemUI/src/com/android/systemui/power/PowerUI.java b/packages/SystemUI/src/com/android/systemui/power/PowerUI.java
index 0d26c57..e084dac 100644
--- a/packages/SystemUI/src/com/android/systemui/power/PowerUI.java
+++ b/packages/SystemUI/src/com/android/systemui/power/PowerUI.java
@@ -16,10 +16,6 @@
package com.android.systemui.power;
-import java.io.FileDescriptor;
-import java.io.PrintWriter;
-import java.util.Arrays;
-
import android.app.AlertDialog;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
@@ -27,13 +23,13 @@
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
+import android.media.AudioManager;
+import android.media.Ringtone;
+import android.media.RingtoneManager;
import android.net.Uri;
import android.os.BatteryManager;
import android.os.Handler;
import android.os.UserHandle;
-import android.media.AudioManager;
-import android.media.Ringtone;
-import android.media.RingtoneManager;
import android.provider.Settings;
import android.util.Log;
import android.view.View;
@@ -43,6 +39,10 @@
import com.android.systemui.R;
import com.android.systemui.SystemUI;
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
+import java.util.Arrays;
+
public class PowerUI extends SystemUI {
static final String TAG = "PowerUI";
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
index 403c643f..ee076d9 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
@@ -21,7 +21,6 @@
import android.content.res.Configuration;
import android.database.DataSetObserver;
import android.graphics.Canvas;
-import android.graphics.Paint;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.FloatMath;
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java
index aa80664..5617520 100644
--- a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java
@@ -45,7 +45,6 @@
import android.os.Process;
import android.provider.MediaStore;
import android.util.DisplayMetrics;
-import android.util.Log;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.MotionEvent;
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/TakeScreenshotService.java b/packages/SystemUI/src/com/android/systemui/screenshot/TakeScreenshotService.java
index 6a0fe47..456b5fa 100644
--- a/packages/SystemUI/src/com/android/systemui/screenshot/TakeScreenshotService.java
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/TakeScreenshotService.java
@@ -23,7 +23,6 @@
import android.os.Message;
import android.os.Messenger;
import android.os.RemoteException;
-import android.util.Log;
public class TakeScreenshotService extends Service {
private static final String TAG = "TakeScreenshotService";
diff --git a/packages/SystemUI/src/com/android/systemui/settings/BrightnessController.java b/packages/SystemUI/src/com/android/systemui/settings/BrightnessController.java
index f5471e5..327e715 100644
--- a/packages/SystemUI/src/com/android/systemui/settings/BrightnessController.java
+++ b/packages/SystemUI/src/com/android/systemui/settings/BrightnessController.java
@@ -18,7 +18,6 @@
import android.content.ContentResolver;
import android.content.Context;
-import android.content.Intent;
import android.database.ContentObserver;
import android.net.Uri;
import android.os.AsyncTask;
@@ -30,8 +29,6 @@
import android.os.UserHandle;
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
-import android.view.IWindowManager;
-import android.widget.CompoundButton;
import android.widget.ImageView;
import java.util.ArrayList;
diff --git a/packages/SystemUI/src/com/android/systemui/settings/BrightnessDialog.java b/packages/SystemUI/src/com/android/systemui/settings/BrightnessDialog.java
index 1b05084..ff79f04 100644
--- a/packages/SystemUI/src/com/android/systemui/settings/BrightnessDialog.java
+++ b/packages/SystemUI/src/com/android/systemui/settings/BrightnessDialog.java
@@ -16,19 +16,16 @@
package com.android.systemui.settings;
-import com.android.systemui.R;
-
import android.app.Dialog;
import android.content.Context;
import android.content.res.Resources;
import android.os.Bundle;
import android.os.Handler;
-import android.util.Log;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
-import java.lang.Runnable;
+import com.android.systemui.R;
/** A dialog that provides controls for adjusting the screen brightness. */
public class BrightnessDialog extends Dialog implements
diff --git a/packages/SystemUI/src/com/android/systemui/settings/SettingsUI.java b/packages/SystemUI/src/com/android/systemui/settings/SettingsUI.java
index 3ab2d9b..8bc72c9 100644
--- a/packages/SystemUI/src/com/android/systemui/settings/SettingsUI.java
+++ b/packages/SystemUI/src/com/android/systemui/settings/SettingsUI.java
@@ -16,9 +16,6 @@
package com.android.systemui.settings;
-import java.io.FileDescriptor;
-import java.io.PrintWriter;
-
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
@@ -30,6 +27,9 @@
import com.android.systemui.SystemUI;
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
+
public class SettingsUI extends SystemUI {
private static final String TAG = "SettingsUI";
private static final boolean DEBUG = false;
diff --git a/packages/SystemUI/src/com/android/systemui/settings/ToggleSlider.java b/packages/SystemUI/src/com/android/systemui/settings/ToggleSlider.java
index e0aefca..d584043 100644
--- a/packages/SystemUI/src/com/android/systemui/settings/ToggleSlider.java
+++ b/packages/SystemUI/src/com/android/systemui/settings/ToggleSlider.java
@@ -23,7 +23,6 @@
import android.util.AttributeSet;
import android.view.View;
import android.widget.CompoundButton;
-import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.SeekBar;
import android.widget.TextView;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index c96d9c9..089099f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -17,21 +17,6 @@
package com.android.systemui.statusbar;
-import android.service.notification.StatusBarNotification;
-import android.content.res.Configuration;
-import com.android.internal.statusbar.IStatusBarService;
-import com.android.internal.statusbar.StatusBarIcon;
-import com.android.internal.statusbar.StatusBarIconList;
-import com.android.internal.widget.SizeAdaptiveLayout;
-import com.android.systemui.R;
-import com.android.systemui.SearchPanelView;
-import com.android.systemui.SystemUI;
-import com.android.systemui.recent.RecentTasksLoader;
-import com.android.systemui.recent.RecentsActivity;
-import com.android.systemui.recent.TaskDescription;
-import com.android.systemui.statusbar.policy.NotificationRowLayout;
-import com.android.systemui.statusbar.tablet.StatusBarPanel;
-
import android.app.ActivityManager;
import android.app.ActivityManagerNative;
import android.app.ActivityOptions;
@@ -45,6 +30,7 @@
import android.content.IntentFilter;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager.NameNotFoundException;
+import android.content.res.Configuration;
import android.content.res.Resources;
import android.database.ContentObserver;
import android.graphics.Bitmap;
@@ -59,6 +45,7 @@
import android.os.ServiceManager;
import android.os.UserHandle;
import android.provider.Settings;
+import android.service.notification.StatusBarNotification;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Log;
@@ -78,6 +65,19 @@
import android.widget.RemoteViews;
import android.widget.TextView;
+import com.android.internal.statusbar.IStatusBarService;
+import com.android.internal.statusbar.StatusBarIcon;
+import com.android.internal.statusbar.StatusBarIconList;
+import com.android.internal.widget.SizeAdaptiveLayout;
+import com.android.systemui.R;
+import com.android.systemui.SearchPanelView;
+import com.android.systemui.SystemUI;
+import com.android.systemui.recent.RecentTasksLoader;
+import com.android.systemui.recent.RecentsActivity;
+import com.android.systemui.recent.TaskDescription;
+import com.android.systemui.statusbar.policy.NotificationRowLayout;
+import com.android.systemui.statusbar.tablet.StatusBarPanel;
+
import java.util.ArrayList;
import java.util.Locale;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
index cbbaab3..43992c8 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
@@ -19,8 +19,8 @@
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
-
import android.service.notification.StatusBarNotification;
+
import com.android.internal.statusbar.IStatusBar;
import com.android.internal.statusbar.StatusBarIcon;
import com.android.internal.statusbar.StatusBarIconList;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/DoNotDisturb.java b/packages/SystemUI/src/com/android/systemui/statusbar/DoNotDisturb.java
index ce67abe..7520434 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/DoNotDisturb.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/DoNotDisturb.java
@@ -17,11 +17,8 @@
package com.android.systemui.statusbar;
import android.app.StatusBarManager;
-import android.content.ContentResolver;
import android.content.Context;
import android.content.SharedPreferences;
-import android.os.RemoteException;
-import android.os.ServiceManager;
import com.android.systemui.statusbar.policy.Prefs;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/GestureRecorder.java b/packages/SystemUI/src/com/android/systemui/statusbar/GestureRecorder.java
index 378061f..f2adaf0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/GestureRecorder.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/GestureRecorder.java
@@ -16,6 +16,12 @@
package com.android.systemui.statusbar;
+import android.os.Handler;
+import android.os.Message;
+import android.os.SystemClock;
+import android.util.Log;
+import android.view.MotionEvent;
+
import java.io.BufferedWriter;
import java.io.FileDescriptor;
import java.io.FileWriter;
@@ -24,12 +30,6 @@
import java.util.HashSet;
import java.util.LinkedList;
-import android.os.Handler;
-import android.os.Message;
-import android.os.SystemClock;
-import android.util.Log;
-import android.view.MotionEvent;
-
/**
* Convenience class for capturing gestures for later analysis.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
index 2c7a2a8..673ca6b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
@@ -16,15 +16,15 @@
package com.android.systemui.statusbar;
-import android.service.notification.StatusBarNotification;
import android.os.IBinder;
+import android.service.notification.StatusBarNotification;
import android.view.View;
import android.widget.ImageView;
import com.android.systemui.R;
-import java.util.Comparator;
import java.util.ArrayList;
+import java.util.Comparator;
/**
* The list of currently displaying notifications.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java b/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java
index de7f189..f17b143e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java
@@ -25,9 +25,8 @@
import android.widget.ImageView;
import android.widget.LinearLayout;
-import com.android.systemui.statusbar.policy.NetworkController;
-
import com.android.systemui.R;
+import com.android.systemui.statusbar.policy.NetworkController;
// Intimately tied to the design of res/layout/signal_cluster_view.xml
public class SignalClusterView
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
index 54c5e2a..8b50a38 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
@@ -20,10 +20,10 @@
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.Resources;
-import android.graphics.drawable.Drawable;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
+import android.graphics.drawable.Drawable;
import android.os.UserHandle;
import android.text.TextUtils;
import android.util.AttributeSet;
@@ -32,12 +32,11 @@
import android.view.accessibility.AccessibilityEvent;
import android.widget.ImageView;
-import java.text.NumberFormat;
-
import com.android.internal.statusbar.StatusBarIcon;
-
import com.android.systemui.R;
+import java.text.NumberFormat;
+
public class StatusBarIconView extends AnimatedImageView {
private static final String TAG = "StatusBarIconView";
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CarrierLabel.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CarrierLabel.java
index 5fa8126..5ea17e7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CarrierLabel.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CarrierLabel.java
@@ -23,17 +23,10 @@
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
-import android.view.View;
import android.widget.TextView;
import com.android.internal.telephony.TelephonyIntents;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.TimeZone;
-
-import com.android.internal.R;
-
/**
* This widget display an analogic clock with two hands for hours and
* minutes.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/IconMerger.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/IconMerger.java
index eae4b7a..50ead3d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/IconMerger.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/IconMerger.java
@@ -17,15 +17,11 @@
package com.android.systemui.statusbar.phone;
import android.content.Context;
-import android.os.Handler;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
-import com.android.internal.statusbar.StatusBarIcon;
-
import com.android.systemui.R;
-import com.android.systemui.statusbar.StatusBarIconView;
public class IconMerger extends LinearLayout {
private static final String TAG = "IconMerger";
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
index f5867ab..9eaee30 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -30,25 +30,25 @@
import android.os.ServiceManager;
import android.util.AttributeSet;
import android.util.Log;
-import android.view.animation.AccelerateInterpolator;
import android.view.Display;
import android.view.MotionEvent;
-import android.view.View;
import android.view.Surface;
+import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
+import android.view.animation.AccelerateInterpolator;
import android.widget.ImageView;
import android.widget.LinearLayout;
-import java.io.FileDescriptor;
-import java.io.PrintWriter;
-
import com.android.internal.statusbar.IStatusBarService;
import com.android.systemui.R;
import com.android.systemui.statusbar.BaseStatusBar;
import com.android.systemui.statusbar.DelegateViewHelper;
import com.android.systemui.statusbar.policy.DeadZone;
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
+
public class NavigationBarView extends LinearLayout {
final static boolean DEBUG = false;
final static String TAG = "PhoneStatusBar/NavigationBarView";
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java
index 91e1aa0..751d944 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java
@@ -16,8 +16,6 @@
package com.android.systemui.statusbar.phone;
-import java.util.ArrayList;
-
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
@@ -25,6 +23,8 @@
import android.view.View;
import android.widget.FrameLayout;
+import java.util.ArrayList;
+
public class PanelBar extends FrameLayout {
public static final boolean DEBUG = false;
public static final String TAG = PanelBar.class.getSimpleName();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
index 70cb94a..cf7f9c6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
@@ -16,11 +16,6 @@
package com.android.systemui.statusbar.phone;
-import java.io.FileDescriptor;
-import java.io.PrintWriter;
-import java.util.ArrayDeque;
-import java.util.Iterator;
-
import android.animation.ObjectAnimator;
import android.animation.TimeAnimator;
import android.animation.TimeAnimator.TimeListener;
@@ -34,6 +29,11 @@
import com.android.systemui.R;
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
+import java.util.ArrayDeque;
+import java.util.Iterator;
+
public class PanelView extends FrameLayout {
public static final boolean DEBUG = PanelBar.DEBUG;
public static final String TAG = PanelView.class.getSimpleName();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index 97c7b98a..38f13b4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -26,7 +26,6 @@
import android.app.Notification;
import android.app.PendingIntent;
import android.app.StatusBarManager;
-import android.service.notification.StatusBarNotification;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -52,6 +51,7 @@
import android.provider.Settings;
import android.service.dreams.DreamService;
import android.service.dreams.IDreamManager;
+import android.service.notification.StatusBarNotification;
import android.util.DisplayMetrics;
import android.util.EventLog;
import android.util.Log;
@@ -87,7 +87,6 @@
import com.android.systemui.statusbar.NotificationData.Entry;
import com.android.systemui.statusbar.SignalClusterView;
import com.android.systemui.statusbar.StatusBarIconView;
-import com.android.systemui.statusbar.policy.RotationLockController;
import com.android.systemui.statusbar.policy.BatteryController;
import com.android.systemui.statusbar.policy.BluetoothController;
import com.android.systemui.statusbar.policy.DateView;
@@ -97,6 +96,7 @@
import com.android.systemui.statusbar.policy.NotificationRowLayout;
import com.android.systemui.statusbar.policy.OnSizeChangedListener;
import com.android.systemui.statusbar.policy.Prefs;
+import com.android.systemui.statusbar.policy.RotationLockController;
import java.io.FileDescriptor;
import java.io.PrintWriter;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
index 80734ee..57ec0e5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
@@ -22,28 +22,14 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
-import android.location.LocationManager;
import android.media.AudioManager;
-import android.net.ConnectivityManager;
-import android.net.NetworkInfo;
-import android.net.wifi.WifiManager;
-import android.os.Binder;
import android.os.Handler;
-import android.os.RemoteException;
import android.os.storage.StorageManager;
-import android.provider.Settings;
-import android.telephony.PhoneStateListener;
-import android.telephony.ServiceState;
-import android.telephony.SignalStrength;
-import android.telephony.TelephonyManager;
import android.util.Log;
-import com.android.internal.telephony.IccCard;
import com.android.internal.telephony.IccCardConstants;
import com.android.internal.telephony.TelephonyIntents;
-import com.android.internal.telephony.cdma.EriInfo;
import com.android.internal.telephony.cdma.TtyIntent;
-import com.android.server.am.BatteryStatsService;
import com.android.systemui.R;
/**
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java
index b20a8bb..9ee6065 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java
@@ -16,19 +16,6 @@
package com.android.systemui.statusbar.phone;
-import com.android.systemui.R;
-
-import com.android.systemui.statusbar.phone.QuickSettingsModel.BluetoothState;
-import com.android.systemui.statusbar.phone.QuickSettingsModel.RSSIState;
-import com.android.systemui.statusbar.phone.QuickSettingsModel.State;
-import com.android.systemui.statusbar.phone.QuickSettingsModel.UserState;
-import com.android.systemui.statusbar.phone.QuickSettingsModel.WifiState;
-import com.android.systemui.statusbar.policy.BatteryController;
-import com.android.systemui.statusbar.policy.BluetoothController;
-import com.android.systemui.statusbar.policy.LocationController;
-import com.android.systemui.statusbar.policy.NetworkController;
-import com.android.systemui.statusbar.policy.RotationLockController;
-
import android.app.ActivityManagerNative;
import android.app.AlertDialog;
import android.app.Dialog;
@@ -71,6 +58,18 @@
import android.widget.ImageView;
import android.widget.TextView;
+import com.android.systemui.R;
+import com.android.systemui.statusbar.phone.QuickSettingsModel.BluetoothState;
+import com.android.systemui.statusbar.phone.QuickSettingsModel.RSSIState;
+import com.android.systemui.statusbar.phone.QuickSettingsModel.State;
+import com.android.systemui.statusbar.phone.QuickSettingsModel.UserState;
+import com.android.systemui.statusbar.phone.QuickSettingsModel.WifiState;
+import com.android.systemui.statusbar.policy.BatteryController;
+import com.android.systemui.statusbar.policy.BluetoothController;
+import com.android.systemui.statusbar.policy.LocationController;
+import com.android.systemui.statusbar.policy.NetworkController;
+import com.android.systemui.statusbar.policy.RotationLockController;
+
import java.util.ArrayList;
/**
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsBasicTile.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsBasicTile.java
index 94b2fc7..ef850d5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsBasicTile.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsBasicTile.java
@@ -16,8 +16,6 @@
package com.android.systemui.statusbar.phone;
-import com.android.systemui.R;
-
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
@@ -26,6 +24,8 @@
import android.widget.ImageView;
import android.widget.TextView;
+import com.android.systemui.R;
+
class QuickSettingsBasicTile extends QuickSettingsTileView {
private final TextView mTextView;
private final ImageView mImageView;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java
index b0aca16..79495a7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java
@@ -40,13 +40,13 @@
import android.view.inputmethod.InputMethodSubtype;
import com.android.systemui.R;
-import com.android.systemui.settings.CurrentUserTracker;
import com.android.systemui.settings.BrightnessController.BrightnessStateChangeCallback;
-import com.android.systemui.statusbar.policy.RotationLockController;
-import com.android.systemui.statusbar.policy.RotationLockController.RotationLockControllerCallback;
+import com.android.systemui.settings.CurrentUserTracker;
import com.android.systemui.statusbar.policy.BatteryController.BatteryStateChangeCallback;
import com.android.systemui.statusbar.policy.LocationController.LocationGpsStateChangeCallback;
import com.android.systemui.statusbar.policy.NetworkController.NetworkSignalChangedCallback;
+import com.android.systemui.statusbar.policy.RotationLockController;
+import com.android.systemui.statusbar.policy.RotationLockController.RotationLockControllerCallback;
import java.util.List;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SettingsPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SettingsPanelView.java
index 1897589..c10a0d4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SettingsPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SettingsPanelView.java
@@ -16,23 +16,18 @@
package com.android.systemui.statusbar.phone;
-import android.animation.LayoutTransition;
import android.content.Context;
-import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.util.EventLog;
-import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
-import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import com.android.systemui.EventLogTags;
import com.android.systemui.R;
-import com.android.systemui.statusbar.BaseStatusBar;
import com.android.systemui.statusbar.GestureRecorder;
import com.android.systemui.statusbar.policy.BatteryController;
import com.android.systemui.statusbar.policy.BluetoothController;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
index 5620e1b..a600aae 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
@@ -20,14 +20,12 @@
import android.graphics.Canvas;
import android.graphics.Paint;
import android.util.AttributeSet;
-import android.util.Log;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewRootImpl;
import android.widget.FrameLayout;
import android.widget.ScrollView;
-import android.widget.TextSwitcher;
import com.android.systemui.ExpandHelper;
import com.android.systemui.R;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/Ticker.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/Ticker.java
index b1ccd00..a784f37 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/Ticker.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/Ticker.java
@@ -16,27 +16,26 @@
package com.android.systemui.statusbar.phone;
-import android.service.notification.StatusBarNotification;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Handler;
-import android.text.StaticLayout;
+import android.service.notification.StatusBarNotification;
import android.text.Layout.Alignment;
+import android.text.StaticLayout;
import android.text.TextPaint;
import android.view.View;
import android.view.animation.AnimationUtils;
+import android.widget.ImageSwitcher;
import android.widget.TextSwitcher;
import android.widget.TextView;
-import android.widget.ImageSwitcher;
-
-import java.util.ArrayList;
import com.android.internal.statusbar.StatusBarIcon;
-
import com.android.systemui.R;
import com.android.systemui.statusbar.StatusBarIconView;
+import java.util.ArrayList;
+
public abstract class Ticker {
private static final int TICKER_SEGMENT_DELAY = 3000;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/TrackingPatternView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/TrackingPatternView.java
index f3cf65c..68807a0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/TrackingPatternView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/TrackingPatternView.java
@@ -17,13 +17,12 @@
package com.android.systemui.statusbar.phone;
import android.content.Context;
-import android.content.res.TypedArray;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.graphics.Canvas;
+import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;
-import android.graphics.BitmapFactory;
-import android.graphics.Bitmap;
-import android.graphics.Paint;
-import android.graphics.Canvas;
public class TrackingPatternView extends View {
private Bitmap mTexture;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/AirplaneModeController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/AirplaneModeController.java
index 71a7aa8..8bbe957 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/AirplaneModeController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/AirplaneModeController.java
@@ -22,8 +22,6 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.os.AsyncTask;
-import android.os.RemoteException;
-import android.os.ServiceManager;
import android.os.UserHandle;
import android.provider.Settings;
import android.widget.CompoundButton;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BatteryController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BatteryController.java
index 0f56ba6..452ff489 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BatteryController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BatteryController.java
@@ -16,9 +16,6 @@
package com.android.systemui.statusbar.policy;
-import java.util.ArrayList;
-
-import android.bluetooth.BluetoothAdapter.BluetoothStateChangeCallback;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -29,6 +26,8 @@
import com.android.systemui.R;
+import java.util.ArrayList;
+
public class BatteryController extends BroadcastReceiver {
private static final String TAG = "StatusBar.BatteryController";
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java
index 91a1a6d..e5816cd 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java
@@ -20,21 +20,12 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
-import android.content.res.Resources;
-import android.content.res.TypedArray;
-import android.graphics.Canvas;
-import android.graphics.Typeface;
-import android.graphics.drawable.Drawable;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.format.DateFormat;
import android.text.style.CharacterStyle;
-import android.text.style.ForegroundColorSpan;
import android.text.style.RelativeSizeSpan;
-import android.text.style.RelativeSizeSpan;
-import android.text.style.StyleSpan;
import android.util.AttributeSet;
-import android.view.View;
import android.widget.TextView;
import java.text.SimpleDateFormat;
@@ -44,8 +35,6 @@
import libcore.icu.LocaleData;
-import com.android.internal.R;
-
/**
* Digital clock for the status bar.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/CompatModeButton.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/CompatModeButton.java
index 3083e8b..7939752 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/CompatModeButton.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/CompatModeButton.java
@@ -18,15 +18,11 @@
import android.app.ActivityManager;
import android.content.Context;
-import android.content.res.TypedArray;
-import android.os.RemoteException;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
-import com.android.systemui.R;
-
public class CompatModeButton extends ImageView {
private static final boolean DEBUG = false;
private static final String TAG = "StatusBar.CompatModeButton";
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/DoNotDisturbController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/DoNotDisturbController.java
index d45a94f..8612c8f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/DoNotDisturbController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/DoNotDisturbController.java
@@ -16,14 +16,8 @@
package com.android.systemui.statusbar.policy;
-import android.content.ContentResolver;
import android.content.Context;
import android.content.SharedPreferences;
-import android.os.RemoteException;
-import android.os.ServiceManager;
-import android.provider.Settings;
-import android.util.Log;
-import android.view.IWindowManager;
import android.widget.CompoundButton;
public class DoNotDisturbController implements CompoundButton.OnCheckedChangeListener,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/EventHole.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/EventHole.java
index 4de4241..aca88fe 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/EventHole.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/EventHole.java
@@ -17,26 +17,10 @@
package com.android.systemui.statusbar.policy;
import android.content.Context;
-import android.content.res.TypedArray;
import android.graphics.Region;
-import android.graphics.drawable.AnimationDrawable;
-import android.graphics.drawable.Drawable;
-import android.os.RemoteException;
-import android.os.SystemClock;
-import android.os.ServiceManager;
import android.util.AttributeSet;
-import android.view.HapticFeedbackConstants;
-import android.view.IWindowManager;
-import android.view.InputDevice;
-import android.view.KeyCharacterMap;
-import android.view.KeyEvent;
-import android.view.MotionEvent;
import android.view.View;
-import android.view.ViewConfiguration;
import android.view.ViewTreeObserver;
-import android.widget.RemoteViews.RemoteView;
-
-import com.android.systemui.R;
public class EventHole extends View implements ViewTreeObserver.OnComputeInternalInsetsListener {
private static final String TAG = "StatusBar.EventHole";
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/FixedSizeDrawable.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/FixedSizeDrawable.java
index 3751399..af20411 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/FixedSizeDrawable.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/FixedSizeDrawable.java
@@ -16,10 +16,10 @@
package com.android.systemui.statusbar.policy;
-import android.graphics.drawable.Drawable;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Rect;
+import android.graphics.drawable.Drawable;
public class FixedSizeDrawable extends Drawable {
Drawable mDrawable;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/IntruderAlertView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/IntruderAlertView.java
index 9b96384..dbd36af 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/IntruderAlertView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/IntruderAlertView.java
@@ -16,21 +16,14 @@
package com.android.systemui.statusbar.policy;
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.LayoutTransition;
-import android.animation.ObjectAnimator;
-import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.Configuration;
-import android.content.res.TypedArray;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
-import android.view.View.OnClickListener;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.widget.LinearLayout;
@@ -40,8 +33,6 @@
import com.android.systemui.SwipeHelper;
import com.android.systemui.statusbar.BaseStatusBar;
-import java.util.HashMap;
-
public class IntruderAlertView extends LinearLayout implements SwipeHelper.Callback {
private static final String TAG = "IntruderAlertView";
private static final boolean DEBUG = false;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java
index db0e4c3..fc77be1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java
@@ -20,17 +20,13 @@
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.TypedArray;
-import android.graphics.drawable.Drawable;
import android.graphics.Canvas;
import android.graphics.RectF;
+import android.graphics.drawable.Drawable;
import android.hardware.input.InputManager;
-import android.os.RemoteException;
import android.os.SystemClock;
-import android.os.ServiceManager;
import android.util.AttributeSet;
-import android.view.accessibility.AccessibilityEvent;
import android.view.HapticFeedbackConstants;
-import android.view.IWindowManager;
import android.view.InputDevice;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
@@ -38,6 +34,7 @@
import android.view.SoundEffectConstants;
import android.view.View;
import android.view.ViewConfiguration;
+import android.view.accessibility.AccessibilityEvent;
import android.widget.ImageView;
import com.android.systemui.R;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationController.java
index 68d048d..63f1254 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationController.java
@@ -16,8 +16,7 @@
package com.android.systemui.statusbar.policy;
-import java.util.ArrayList;
-
+import android.app.INotificationManager;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
@@ -29,11 +28,10 @@
import android.os.UserHandle;
import android.provider.Settings;
-// private NM API
-import android.app.INotificationManager;
-
import com.android.systemui.R;
+import java.util.ArrayList;
+
public class LocationController extends BroadcastReceiver {
private static final String TAG = "StatusBar.LocationController";
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
index 57c347b..a19b52a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
@@ -90,6 +90,7 @@
boolean mShowPhoneRSSIForData = false;
boolean mShowAtLeastThreeGees = false;
boolean mAlwaysShowCdmaRssi = false;
+ boolean mShow4GforLTE = false;
String mContentDescriptionPhoneSignal;
String mContentDescriptionWifi;
@@ -199,6 +200,7 @@
mShowPhoneRSSIForData = res.getBoolean(R.bool.config_showPhoneRSSIForData);
mShowAtLeastThreeGees = res.getBoolean(R.bool.config_showMin3G);
+ mShow4GforLTE = res.getBoolean(R.bool.config_show4GForLTE);
mAlwaysShowCdmaRssi = res.getBoolean(
com.android.internal.R.bool.config_alwaysUseCdmaRssi);
@@ -678,11 +680,19 @@
R.string.accessibility_data_connection_3g);
break;
case TelephonyManager.NETWORK_TYPE_LTE:
- mDataIconList = TelephonyIcons.DATA_4G[mInetCondition];
- mDataTypeIconId = R.drawable.stat_sys_data_connected_4g;
- mQSDataTypeIconId = R.drawable.ic_qs_signal_4g;
- mContentDescriptionDataType = mContext.getString(
- R.string.accessibility_data_connection_4g);
+ if (mShow4GforLTE) {
+ mDataIconList = TelephonyIcons.DATA_4G[mInetCondition];
+ mDataTypeIconId = R.drawable.stat_sys_data_connected_4g;
+ mQSDataTypeIconId = R.drawable.ic_qs_signal_4g;
+ mContentDescriptionDataType = mContext.getString(
+ R.string.accessibility_data_connection_4g);
+ } else {
+ mDataIconList = TelephonyIcons.DATA_LTE[mInetCondition];
+ mDataTypeIconId = R.drawable.stat_sys_data_connected_lte;
+ mQSDataTypeIconId = R.drawable.ic_qs_signal_lte;
+ mContentDescriptionDataType = mContext.getString(
+ R.string.accessibility_data_connection_lte);
+ }
break;
default:
if (!mShowAtLeastThreeGees) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java
index 9bf1c1b..cd8445c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java
@@ -16,14 +16,10 @@
package com.android.systemui.statusbar.policy;
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
import android.animation.LayoutTransition;
-import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.Configuration;
-import android.content.res.TypedArray;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.Log;
@@ -31,7 +27,6 @@
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
-import android.view.inputmethod.InputMethodManager;
import android.widget.LinearLayout;
import com.android.systemui.ExpandHelper;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java
index 3b953a0..4b2c65e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java
@@ -136,6 +136,17 @@
R.drawable.stat_sys_data_fully_connected_4g }
};
+ // LTE branded "LTE"
+ static final int[][] DATA_LTE = {
+ { R.drawable.stat_sys_data_connected_lte,
+ R.drawable.stat_sys_data_connected_lte,
+ R.drawable.stat_sys_data_connected_lte,
+ R.drawable.stat_sys_data_connected_lte },
+ { R.drawable.stat_sys_data_fully_connected_lte,
+ R.drawable.stat_sys_data_fully_connected_lte,
+ R.drawable.stat_sys_data_fully_connected_lte,
+ R.drawable.stat_sys_data_fully_connected_lte }
+ };
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/VolumeController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/VolumeController.java
index 3e138d5..d3707f2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/VolumeController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/VolumeController.java
@@ -16,15 +16,9 @@
package com.android.systemui.statusbar.policy;
-import android.content.ContentResolver;
import android.content.Context;
-import android.os.RemoteException;
-import android.os.ServiceManager;
-import android.os.Vibrator;
import android.media.AudioManager;
-import android.provider.Settings;
-import android.view.IWindowManager;
-import android.widget.CompoundButton;
+import android.os.Vibrator;
import com.android.systemui.settings.ToggleSlider;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/WimaxIcons.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/WimaxIcons.java
index d3d4338..4877828 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/WimaxIcons.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/WimaxIcons.java
@@ -1,28 +1,27 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.statusbar.policy;
-
-import com.android.systemui.statusbar.policy.TelephonyIcons;
-import com.android.systemui.R;
-
-class WimaxIcons {
- static final int[][] WIMAX_SIGNAL_STRENGTH = TelephonyIcons.DATA_SIGNAL_STRENGTH;
-
- static final int WIMAX_DISCONNECTED = WIMAX_SIGNAL_STRENGTH[0][0];
-
- static final int WIMAX_IDLE = WIMAX_DISCONNECTED; // XXX: unclear if we need a different icon
-}
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.statusbar.policy;
+
+import com.android.systemui.statusbar.policy.TelephonyIcons;
+
+class WimaxIcons {
+ static final int[][] WIMAX_SIGNAL_STRENGTH = TelephonyIcons.DATA_SIGNAL_STRENGTH;
+
+ static final int WIMAX_DISCONNECTED = WIMAX_SIGNAL_STRENGTH[0][0];
+
+ static final int WIMAX_IDLE = WIMAX_DISCONNECTED; // XXX: unclear if we need a different icon
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/CompatModePanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/CompatModePanel.java
index 080cbd5..10bbf56 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/CompatModePanel.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/CompatModePanel.java
@@ -18,15 +18,11 @@
import android.app.ActivityManager;
import android.content.Context;
-import android.content.res.TypedArray;
-import android.os.RemoteException;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.widget.FrameLayout;
-import android.widget.ImageView;
import android.widget.RadioButton;
-import android.widget.RadioGroup;
import com.android.systemui.R;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodButton.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodButton.java
index fa8aa6d..aead242 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodButton.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodButton.java
@@ -20,10 +20,10 @@
import android.os.IBinder;
import android.provider.Settings;
import android.util.AttributeSet;
+import android.view.View;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodManager;
import android.view.inputmethod.InputMethodSubtype;
-import android.view.View;
import android.widget.ImageView;
import com.android.systemui.R;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodsPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodsPanel.java
index 8924087..6699379 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodsPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodsPanel.java
@@ -16,8 +16,6 @@
package com.android.systemui.statusbar.tablet;
-import com.android.systemui.R;
-
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -41,6 +39,8 @@
import android.widget.Switch;
import android.widget.TextView;
+import com.android.systemui.R;
+
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationIconArea.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationIconArea.java
index 4f3c4d5..6e93cee 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationIconArea.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationIconArea.java
@@ -17,14 +17,10 @@
package com.android.systemui.statusbar.tablet;
import android.content.Context;
-import android.content.res.Resources;
-import android.os.Handler;
import android.util.AttributeSet;
-import android.view.View;
+import android.view.MotionEvent;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
-import android.widget.ImageView;
-import android.view.MotionEvent;
import com.android.systemui.R;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationLinearLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationLinearLayout.java
index 51980dd..6d15e87 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationLinearLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationLinearLayout.java
@@ -16,9 +16,6 @@
package com.android.systemui.statusbar.tablet;
-import android.animation.Animator;
-import android.animation.ObjectAnimator;
-import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
@@ -26,14 +23,8 @@
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
-import android.view.LayoutInflater;
import android.view.View;
-import android.view.ViewGroup;
-import android.view.animation.AccelerateInterpolator;
-import android.widget.FrameLayout;
-import android.widget.ImageView;
import android.widget.LinearLayout;
-import android.widget.TextView;
import com.android.systemui.R;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanelTitle.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanelTitle.java
index d180ab9..8eeeb14 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanelTitle.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanelTitle.java
@@ -16,8 +16,6 @@
package com.android.systemui.statusbar.tablet;
-import java.util.ArrayList;
-
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
@@ -28,6 +26,8 @@
import com.android.systemui.R;
+import java.util.ArrayList;
+
public class NotificationPanelTitle extends RelativeLayout implements View.OnClickListener {
private NotificationPanel mPanel;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/ShirtPocket.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/ShirtPocket.java
index 48486b2..7ac4fd6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/ShirtPocket.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/ShirtPocket.java
@@ -20,25 +20,17 @@
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.content.ClipData;
-import android.content.ClipDescription;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
-import android.graphics.PixelFormat;
import android.graphics.Point;
import android.util.AttributeSet;
import android.util.Log;
import android.view.DragEvent;
-import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
-import android.view.WindowManager;
-import android.widget.FrameLayout;
import android.widget.ImageView;
-import android.widget.TextView;
-
-import com.android.systemui.R;
public class ShirtPocket extends ImageView {
private static final boolean DEBUG = false;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
index c2054d0..b938716 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
@@ -23,7 +23,6 @@
import android.app.Notification;
import android.app.PendingIntent;
import android.app.StatusBarManager;
-import android.service.notification.StatusBarNotification;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -39,6 +38,7 @@
import android.os.IBinder;
import android.os.Message;
import android.os.RemoteException;
+import android.service.notification.StatusBarNotification;
import android.text.TextUtils;
import android.util.Log;
import android.view.Display;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarView.java
index cd1c942..5c901c0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarView.java
@@ -16,18 +16,18 @@
package com.android.systemui.statusbar.tablet;
-import com.android.systemui.R;
-import com.android.systemui.statusbar.BaseStatusBar;
-import com.android.systemui.statusbar.DelegateViewHelper;
-
import android.content.Context;
import android.os.Handler;
import android.util.AttributeSet;
import android.util.Log;
-import android.view.View;
import android.view.MotionEvent;
+import android.view.View;
import android.widget.FrameLayout;
+import com.android.systemui.R;
+import com.android.systemui.statusbar.BaseStatusBar;
+import com.android.systemui.statusbar.DelegateViewHelper;
+
public class TabletStatusBarView extends FrameLayout {
private Handler mHandler;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletTicker.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletTicker.java
index 04e0e56..167f03c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletTicker.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletTicker.java
@@ -16,12 +16,9 @@
package com.android.systemui.statusbar.tablet;
-import java.util.Arrays;
-
import android.animation.LayoutTransition;
import android.app.Notification;
import android.app.PendingIntent;
-import android.service.notification.StatusBarNotification;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.PixelFormat;
@@ -29,6 +26,7 @@
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
+import android.service.notification.StatusBarNotification;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
@@ -40,10 +38,11 @@
import android.widget.TextView;
import com.android.internal.statusbar.StatusBarIcon;
-
import com.android.systemui.R;
import com.android.systemui.statusbar.StatusBarIconView;
+import java.util.Arrays;
+
public class TabletTicker
extends Handler
implements LayoutTransition.TransitionListener {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java
index dc5de02..18b9e26 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java
@@ -16,15 +16,15 @@
package com.android.systemui.statusbar.tv;
-import android.service.notification.StatusBarNotification;
-import com.android.internal.statusbar.StatusBarIcon;
-import com.android.systemui.statusbar.BaseStatusBar;
-
import android.os.IBinder;
+import android.service.notification.StatusBarNotification;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.view.WindowManager;
+import com.android.internal.statusbar.StatusBarIcon;
+import com.android.systemui.statusbar.BaseStatusBar;
+
/*
* Status bar implementation for "large screen" products that mostly present no on-screen nav
*/
diff --git a/packages/SystemUI/src/com/android/systemui/usb/UsbAccessoryUriActivity.java b/packages/SystemUI/src/com/android/systemui/usb/UsbAccessoryUriActivity.java
index ff06630..b5f98ad 100644
--- a/packages/SystemUI/src/com/android/systemui/usb/UsbAccessoryUriActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/usb/UsbAccessoryUriActivity.java
@@ -16,22 +16,19 @@
package com.android.systemui.usb;
-import android.app.Activity;
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
-import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
-import android.net.Uri;
import android.hardware.usb.UsbAccessory;
import android.hardware.usb.UsbManager;
+import android.net.Uri;
import android.os.Bundle;
import android.os.UserHandle;
import android.util.Log;
import com.android.internal.app.AlertActivity;
import com.android.internal.app.AlertController;
-
import com.android.systemui.R;
/**
diff --git a/packages/SystemUI/src/com/android/systemui/usb/UsbDebuggingActivity.java b/packages/SystemUI/src/com/android/systemui/usb/UsbDebuggingActivity.java
index 2c25236..7abfc88 100644
--- a/packages/SystemUI/src/com/android/systemui/usb/UsbDebuggingActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/usb/UsbDebuggingActivity.java
@@ -23,9 +23,7 @@
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
-import android.graphics.Typeface;
import android.hardware.usb.IUsbManager;
-import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbManager;
import android.os.Bundle;
import android.os.IBinder;
@@ -35,12 +33,9 @@
import android.view.LayoutInflater;
import android.view.View;
import android.widget.CheckBox;
-import android.widget.LinearLayout;
-import android.widget.TextView;
import com.android.internal.app.AlertActivity;
import com.android.internal.app.AlertController;
-
import com.android.systemui.R;
public class UsbDebuggingActivity extends AlertActivity
diff --git a/packages/SystemUI/src/com/android/systemui/usb/UsbPermissionActivity.java b/packages/SystemUI/src/com/android/systemui/usb/UsbPermissionActivity.java
index 6e88d0d..1e69fc5 100644
--- a/packages/SystemUI/src/com/android/systemui/usb/UsbPermissionActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/usb/UsbPermissionActivity.java
@@ -16,7 +16,6 @@
package com.android.systemui.usb;
-import android.app.Activity;
import android.app.AlertDialog;
import android.app.PendingIntent;
import android.content.Context;
@@ -25,8 +24,8 @@
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.hardware.usb.IUsbManager;
-import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbAccessory;
+import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbManager;
import android.os.Bundle;
import android.os.IBinder;
@@ -42,7 +41,6 @@
import com.android.internal.app.AlertActivity;
import com.android.internal.app.AlertController;
-
import com.android.systemui.R;
public class UsbPermissionActivity extends AlertActivity
diff --git a/packages/SystemUI/src/com/android/systemui/usb/UsbStorageActivity.java b/packages/SystemUI/src/com/android/systemui/usb/UsbStorageActivity.java
index e61ef8a..65315f3 100644
--- a/packages/SystemUI/src/com/android/systemui/usb/UsbStorageActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/usb/UsbStorageActivity.java
@@ -16,7 +16,6 @@
package com.android.systemui.usb;
-import com.android.internal.R;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.AlertDialog;
@@ -24,31 +23,30 @@
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
+import android.content.DialogInterface.OnCancelListener;
import android.content.Intent;
import android.content.IntentFilter;
-import android.content.DialogInterface.OnCancelListener;
import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageManager;
-import android.content.pm.PackageManager.NameNotFoundException;
import android.hardware.usb.UsbManager;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IBinder;
-import android.os.storage.IMountService;
-import android.os.storage.StorageManager;
-import android.os.storage.StorageEventListener;
import android.os.RemoteException;
import android.os.ServiceManager;
-import android.widget.ImageView;
+import android.os.storage.IMountService;
+import android.os.storage.StorageEventListener;
+import android.os.storage.StorageManager;
+import android.util.Log;
+import android.view.View;
+import android.view.WindowManager;
import android.widget.Button;
+import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
-import android.view.View;
-import android.view.Window;
-import android.view.WindowManager;
-import android.util.Log;
+
+import com.android.internal.R;
import java.util.List;
diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java
index f4065ed..6ddf3a1 100644
--- a/services/java/com/android/server/NotificationManagerService.java
+++ b/services/java/com/android/server/NotificationManagerService.java
@@ -1390,7 +1390,7 @@
return ;
}
- final boolean isSystemToast = ("android".equals(pkg));
+ final boolean isSystemToast = isCallerSystem() || ("android".equals(pkg));
if (ENABLE_BLOCKED_TOASTS && !noteNotificationOp(pkg, Binder.getCallingUid())) {
if (!isSystemToast) {
@@ -1608,7 +1608,7 @@
Slog.v(TAG, "enqueueNotificationInternal: pkg=" + pkg + " id=" + id + " notification=" + notification);
}
checkCallerIsSystemOrSameApp(pkg);
- final boolean isSystemNotification = ("android".equals(pkg));
+ final boolean isSystemNotification = isCallerSystem() || ("android".equals(pkg));
userId = ActivityManager.handleIncomingUser(callingPid,
callingUid, userId, true, false, "enqueueNotification", pkg);
@@ -2084,19 +2084,26 @@
cancelAllNotificationsInt(pkg, 0, Notification.FLAG_FOREGROUND_SERVICE, true, userId);
}
+ // Return true if the caller is a system or phone UID and therefore should not have
+ // any notifications or toasts blocked.
+ boolean isCallerSystem() {
+ final int uid = Binder.getCallingUid();
+ final int appid = UserHandle.getAppId(uid);
+ return (appid == Process.SYSTEM_UID || appid == Process.PHONE_UID || uid == 0);
+ }
+
void checkCallerIsSystem() {
- int uid = Binder.getCallingUid();
- if (UserHandle.getAppId(uid) == Process.SYSTEM_UID || uid == 0) {
+ if (isCallerSystem()) {
return;
}
- throw new SecurityException("Disallowed call for uid " + uid);
+ throw new SecurityException("Disallowed call for uid " + Binder.getCallingUid());
}
void checkCallerIsSystemOrSameApp(String pkg) {
- int uid = Binder.getCallingUid();
- if (UserHandle.getAppId(uid) == Process.SYSTEM_UID || uid == 0) {
+ if (isCallerSystem()) {
return;
}
+ final int uid = Binder.getCallingUid();
try {
ApplicationInfo ai = AppGlobals.getPackageManager().getApplicationInfo(
pkg, 0, UserHandle.getCallingUserId());
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 7c5959d..55f2a32 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -540,7 +540,7 @@
* AppWidget Provider. Make sure MountService is completely started
* first before continuing.
*/
- if (mountService != null) {
+ if (mountService != null && !onlyCore) {
mountService.waitForAsecScan();
}
diff --git a/services/java/com/android/server/WiredAccessoryManager.java b/services/java/com/android/server/WiredAccessoryManager.java
index d5c9c8f..415fcc1 100644
--- a/services/java/com/android/server/WiredAccessoryManager.java
+++ b/services/java/com/android/server/WiredAccessoryManager.java
@@ -44,6 +44,7 @@
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.List;
+import java.util.Locale;
/**
* <p>WiredAccessoryManager monitors for a wired headset on the main board or dock using
@@ -408,11 +409,11 @@
public String getDevName() { return mDevName; }
public String getDevPath() {
- return String.format("/devices/virtual/switch/%s", mDevName);
+ return String.format(Locale.US, "/devices/virtual/switch/%s", mDevName);
}
public String getSwitchStatePath() {
- return String.format("/sys/class/switch/%s/state", mDevName);
+ return String.format(Locale.US, "/sys/class/switch/%s/state", mDevName);
}
public boolean checkSwitchExists() {
diff --git a/services/java/com/android/server/am/ActiveServices.java b/services/java/com/android/server/am/ActiveServices.java
index 98c4352..912c465 100644
--- a/services/java/com/android/server/am/ActiveServices.java
+++ b/services/java/com/android/server/am/ActiveServices.java
@@ -27,6 +27,7 @@
import java.util.List;
import com.android.internal.os.BatteryStatsImpl;
+import com.android.internal.os.TransferPipe;
import com.android.server.am.ActivityManagerService.ItemMatcher;
import com.android.server.am.ActivityManagerService.NeededUriGrants;
@@ -1014,7 +1015,7 @@
Slog.v(TAG_MU, "bringUpServiceLocked: appInfo.uid=" + r.appInfo.uid + " app=" + app);
if (app != null && app.thread != null) {
try {
- app.addPackage(r.appInfo.packageName);
+ app.addPackage(r.appInfo.packageName, mAm.mProcessTracker);
realStartServiceLocked(r, app);
return null;
} catch (RemoteException e) {
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index f06b9a6..2124095 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -32,6 +32,7 @@
import com.android.internal.app.IAppOpsService;
import com.android.internal.os.BatteryStatsImpl;
import com.android.internal.os.ProcessStats;
+import com.android.internal.os.TransferPipe;
import com.android.internal.util.FastXmlSerializer;
import com.android.server.AppOpsService;
import com.android.server.AttributeCache;
@@ -816,10 +817,10 @@
int mNumNonCachedProcs = 0;
/**
- * Keep track of the number of cached procs, to balance oom adj
+ * Keep track of the number of cached hidden procs, to balance oom adj
* distribution between those and empty procs.
*/
- int mNumCachedProcs = 0;
+ int mNumCachedHiddenProcs = 0;
/**
* Keep track of the number of service processes we last found, to
@@ -2150,7 +2151,7 @@
// come up (we have a pid but not yet its thread), so keep it.
if (DEBUG_PROCESSES) Slog.v(TAG, "App already running: " + app);
// If this is a new package in the process, add the package to the list
- app.addPackage(info.packageName);
+ app.addPackage(info.packageName, mProcessTracker);
return app;
}
@@ -2205,7 +2206,7 @@
}
} else {
// If this is a new package in the process, add the package to the list
- app.addPackage(info.packageName);
+ app.addPackage(info.packageName, mProcessTracker);
}
// If the system is not ready yet, then hold off on starting this
@@ -3038,10 +3039,8 @@
proc = p;
break;
}
- for (String str : p.pkgList) {
- if (str.equals(packageName)) {
- proc = p;
- }
+ if (p.pkgList.containsKey(packageName)) {
+ proc = p;
}
}
}
@@ -3422,7 +3421,7 @@
File lastTracesFile = null;
File curTracesFile = null;
for (int i=9; i>=0; i--) {
- String name = String.format("slow%02d.txt", i);
+ String name = String.format(Locale.US, "slow%02d.txt", i);
curTracesFile = new File(tracesDir, name);
if (curTracesFile.exists()) {
if (lastTracesFile != null) {
@@ -4013,7 +4012,7 @@
if (userId != UserHandle.USER_ALL && app.userId != userId) {
continue;
}
- if (!app.pkgList.contains(packageName)) {
+ if (!app.pkgList.containsKey(packageName)) {
continue;
}
}
@@ -6219,7 +6218,7 @@
if (proc.userId != tr.userId) {
continue;
}
- if (!proc.pkgList.contains(pkg)) {
+ if (!proc.pkgList.containsKey(pkg)) {
continue;
}
procs.add(proc);
@@ -6576,7 +6575,7 @@
if (DEBUG_MU)
Slog.v(TAG_MU, "generateApplicationProvidersLocked, cpi.uid = " + cpr.uid);
app.pubProviders.put(cpi.name, cpr);
- app.addPackage(cpi.applicationInfo.packageName);
+ app.addPackage(cpi.applicationInfo.packageName, mProcessTracker);
ensurePackageDexOpt(cpi.applicationInfo.packageName);
}
}
@@ -7315,7 +7314,7 @@
ps = stats.getProcessStatsLocked(info.uid, proc);
}
return new ProcessRecord(ps, thread, info, proc, uid,
- mProcessTracker.getStateLocked(info.processName, info.uid));
+ mProcessTracker.getProcessStateLocked(info.packageName, uid, proc));
}
final ProcessRecord addAppLocked(ApplicationInfo info, boolean isolated) {
@@ -8894,7 +8893,8 @@
int flags = process.info.flags;
IPackageManager pm = AppGlobals.getPackageManager();
sb.append("Flags: 0x").append(Integer.toString(flags, 16)).append("\n");
- for (String pkg : process.pkgList) {
+ for (int ip=0; ip<process.pkgList.size(); ip++) {
+ String pkg = process.pkgList.keyAt(ip);
sb.append("Package: ").append(pkg);
try {
PackageInfo pi = pm.getPackageInfo(pkg, 0, UserHandle.getCallingUserId());
@@ -9629,7 +9629,7 @@
final int NA = procs.size();
for (int ia=0; ia<NA; ia++) {
ProcessRecord r = procs.valueAt(ia);
- if (dumpPackage != null && !r.pkgList.contains(dumpPackage)) {
+ if (dumpPackage != null && !r.pkgList.containsKey(dumpPackage)) {
continue;
}
if (!needSep) {
@@ -9652,7 +9652,7 @@
boolean printed = false;
for (int i=0; i<mIsolatedProcesses.size(); i++) {
ProcessRecord r = mIsolatedProcesses.valueAt(i);
- if (dumpPackage != null && !r.pkgList.contains(dumpPackage)) {
+ if (dumpPackage != null && !r.pkgList.containsKey(dumpPackage)) {
continue;
}
if (!printed) {
@@ -9684,7 +9684,7 @@
boolean printed = false;
for (int i=0; i<mPidsSelfLocked.size(); i++) {
ProcessRecord r = mPidsSelfLocked.valueAt(i);
- if (dumpPackage != null && !r.pkgList.contains(dumpPackage)) {
+ if (dumpPackage != null && !r.pkgList.containsKey(dumpPackage)) {
continue;
}
if (!printed) {
@@ -9707,7 +9707,7 @@
ProcessRecord r = mPidsSelfLocked.get(
mForegroundProcesses.valueAt(i).pid);
if (dumpPackage != null && (r == null
- || !r.pkgList.contains(dumpPackage))) {
+ || !r.pkgList.containsKey(dumpPackage))) {
continue;
}
if (!printed) {
@@ -9765,7 +9765,7 @@
int puid = uids.keyAt(i);
ProcessRecord r = mProcessNames.get(pname, puid);
if (dumpPackage != null && (r == null
- || !r.pkgList.contains(dumpPackage))) {
+ || !r.pkgList.containsKey(dumpPackage))) {
continue;
}
if (!printed) {
@@ -9796,7 +9796,7 @@
int puid = uids.keyAt(i);
ProcessRecord r = mProcessNames.get(pname, puid);
if (dumpPackage != null && (r == null
- || !r.pkgList.contains(dumpPackage))) {
+ || !r.pkgList.containsKey(dumpPackage))) {
continue;
}
if (!printed) {
@@ -9839,7 +9839,7 @@
}
}
if (mHomeProcess != null && (dumpPackage == null
- || mHomeProcess.pkgList.contains(dumpPackage))) {
+ || mHomeProcess.pkgList.containsKey(dumpPackage))) {
if (needSep) {
pw.println();
needSep = false;
@@ -9847,7 +9847,7 @@
pw.println(" mHomeProcess: " + mHomeProcess);
}
if (mPreviousProcess != null && (dumpPackage == null
- || mPreviousProcess.pkgList.contains(dumpPackage))) {
+ || mPreviousProcess.pkgList.containsKey(dumpPackage))) {
if (needSep) {
pw.println();
needSep = false;
@@ -9861,7 +9861,7 @@
pw.println(sb);
}
if (mHeavyWeightProcess != null && (dumpPackage == null
- || mHeavyWeightProcess.pkgList.contains(dumpPackage))) {
+ || mHeavyWeightProcess.pkgList.containsKey(dumpPackage))) {
if (needSep) {
pw.println();
needSep = false;
@@ -9958,7 +9958,8 @@
pw.println(" mLaunchingActivity=" + getFocusedStack().mLaunchingActivity);
pw.println(" mAdjSeq=" + mAdjSeq + " mLruSeq=" + mLruSeq);
pw.println(" mNumNonCachedProcs=" + mNumNonCachedProcs
- + " mNumCachedProcs=" + mNumCachedProcs
+ + " (" + mLruProcesses.size() + " total)"
+ + " mNumCachedHiddenProcs=" + mNumCachedHiddenProcs
+ " mNumServiceProcs=" + mNumServiceProcs
+ " mNewNumServiceProcs=" + mNewNumServiceProcs);
}
@@ -10462,7 +10463,7 @@
= new ArrayList<Pair<ProcessRecord, Integer>>(origList.size());
for (int i=0; i<origList.size(); i++) {
ProcessRecord r = origList.get(i);
- if (dumpPackage != null && !r.pkgList.contains(dumpPackage)) {
+ if (dumpPackage != null && !r.pkgList.containsKey(dumpPackage)) {
continue;
}
list.add(new Pair<ProcessRecord, Integer>(origList.get(i), i));
@@ -11078,7 +11079,6 @@
final void dumpProcessTracker(FileDescriptor fd, PrintWriter pw, String[] args) {
synchronized (this) {
- pw.println("Process Stats:");
mProcessTracker.dumpLocked(fd, pw, args);
}
}
@@ -11786,7 +11786,7 @@
+ ") when registering receiver " + receiver);
}
if (callerApp.info.uid != Process.SYSTEM_UID &&
- !callerApp.pkgList.contains(callerPackage)) {
+ !callerApp.pkgList.containsKey(callerPackage)) {
throw new SecurityException("Given caller package " + callerPackage
+ " is not running in process " + callerApp);
}
@@ -13898,7 +13898,7 @@
}
private final boolean updateOomAdjLocked(ProcessRecord app, int cachedAdj,
- int clientCachedAdj, int emptyAdj, ProcessRecord TOP_APP, boolean doingAll) {
+ int clientCachedAdj, int emptyAdj, ProcessRecord TOP_APP, boolean doingAll, long now) {
app.cachedAdj = cachedAdj;
app.clientCachedAdj = clientCachedAdj;
app.emptyAdj = emptyAdj;
@@ -13935,9 +13935,10 @@
TAG, "Set " + app.pid + " " + app.processName +
" adj " + app.curAdj + ": " + app.adjType);
app.setAdj = app.curAdj;
- if (app.setAdj >= ProcessList.FOREGROUND_APP_ADJ) {
- app.tracker.setState(mProcessList.adjToTrackedState(app.setAdj),
- SystemClock.uptimeMillis());
+ app.setAdjChanged = true;
+ if (!doingAll) {
+ app.setProcessTrackerState(TOP_APP, mProcessTracker.getMemFactor(),
+ now, mProcessList);
}
} else {
success = false;
@@ -13996,7 +13997,7 @@
mAdjSeq++;
boolean success = updateOomAdjLocked(app, app.cachedAdj, app.clientCachedAdj,
- app.emptyAdj, TOP_APP, false);
+ app.emptyAdj, TOP_APP, false, SystemClock.uptimeMillis());
final boolean nowCached = app.curAdj >= ProcessList.CACHED_APP_MIN_ADJ
&& app.curAdj <= ProcessList.CACHED_APP_MAX_ADJ;
if (nowCached != wasCached) {
@@ -14010,7 +14011,8 @@
final void updateOomAdjLocked() {
final ActivityRecord TOP_ACT = resumedAppLocked();
final ProcessRecord TOP_APP = TOP_ACT != null ? TOP_ACT.app : null;
- final long oldTime = SystemClock.uptimeMillis() - ProcessList.MAX_EMPTY_TIME;
+ final long now = SystemClock.uptimeMillis();
+ final long oldTime = now - ProcessList.MAX_EMPTY_TIME;
if (false) {
RuntimeException e = new RuntimeException();
@@ -14039,7 +14041,7 @@
// them.
int numSlots = (ProcessList.CACHED_APP_MAX_ADJ
- ProcessList.CACHED_APP_MIN_ADJ + 1) / 2;
- int numEmptyProcs = mLruProcesses.size()- mNumNonCachedProcs - mNumCachedProcs;
+ int numEmptyProcs = mLruProcesses.size()- mNumNonCachedProcs - mNumCachedHiddenProcs;
if (numEmptyProcs > cachedProcessLimit) {
// If there are more empty processes than our limit on cached
// processes, then use the cached process limit for the factor.
@@ -14051,7 +14053,7 @@
}
int emptyFactor = numEmptyProcs/numSlots;
if (emptyFactor < 1) emptyFactor = 1;
- int cachedFactor = (mNumCachedProcs > 0 ? mNumCachedProcs : 1)/numSlots;
+ int cachedFactor = (mNumCachedHiddenProcs > 0 ? mNumCachedHiddenProcs : 1)/numSlots;
if (cachedFactor < 1) cachedFactor = 1;
int stepCached = 0;
int stepEmpty = 0;
@@ -14060,7 +14062,7 @@
int numTrimming = 0;
mNumNonCachedProcs = 0;
- mNumCachedProcs = 0;
+ mNumCachedHiddenProcs = 0;
// First update the OOM adjustment for each of the
// application processes based on their current state.
@@ -14070,16 +14072,20 @@
int curEmptyAdj = ProcessList.CACHED_APP_MIN_ADJ;
int nextEmptyAdj = curEmptyAdj+2;
int curClientCachedAdj = curEmptyAdj;
+ boolean changed = false;
while (i > 0) {
i--;
ProcessRecord app = mLruProcesses.get(i);
//Slog.i(TAG, "OOM " + app + ": cur cached=" + curCachedAdj);
- updateOomAdjLocked(app, curCachedAdj, curClientCachedAdj, curEmptyAdj, TOP_APP, true);
+ app.setAdjChanged = false;
+ updateOomAdjLocked(app, curCachedAdj, curClientCachedAdj, curEmptyAdj, TOP_APP,
+ true, now);
+ changed |= app.setAdjChanged;
if (!app.killedBackground) {
if (app.curRawAdj == curCachedAdj && app.hasActivities) {
// This process was assigned as a cached process... step the
// cached level.
- mNumCachedProcs++;
+ mNumCachedHiddenProcs++;
if (curCachedAdj != nextCachedAdj) {
stepCached++;
if (stepCached >= cachedFactor) {
@@ -14187,6 +14193,7 @@
// are managing to keep around is less than half the maximum we desire;
// if we are keeping a good number around, we'll let them use whatever
// memory they want.
+ int memFactor = ProcessTracker.STATE_MEM_FACTOR_NORMAL_ADJ;
if (numCached <= ProcessList.TRIM_CACHED_APPS
&& numEmpty <= ProcessList.TRIM_EMPTY_APPS) {
final int numCachedAndEmpty = numCached + numEmpty;
@@ -14200,10 +14207,13 @@
int fgTrimLevel;
if (numCachedAndEmpty <= ProcessList.TRIM_CRITICAL_THRESHOLD) {
fgTrimLevel = ComponentCallbacks2.TRIM_MEMORY_RUNNING_CRITICAL;
+ memFactor = ProcessTracker.STATE_MEM_FACTOR_CRITIAL_ADJ;
} else if (numCachedAndEmpty <= ProcessList.TRIM_LOW_THRESHOLD) {
fgTrimLevel = ComponentCallbacks2.TRIM_MEMORY_RUNNING_LOW;
+ memFactor = ProcessTracker.STATE_MEM_FACTOR_LOW_ADJ;
} else {
fgTrimLevel = ComponentCallbacks2.TRIM_MEMORY_RUNNING_MODERATE;
+ memFactor = ProcessTracker.STATE_MEM_FACTOR_MODERATE_ADJ;
}
int curLevel = ComponentCallbacks2.TRIM_MEMORY_COMPLETE;
for (i=0; i<N; i++) {
@@ -14302,6 +14312,21 @@
// be in a consistent state at this point.
mStackSupervisor.scheduleDestroyAllActivities(null, "always-finish");
}
+
+ boolean allChanged = mProcessTracker.setMemFactor(memFactor, !mSleeping, now);
+ if (changed || allChanged) {
+ memFactor = mProcessTracker.getMemFactor();
+ for (i=mLruProcesses.size()-1; i>=0; i--) {
+ ProcessRecord app = mLruProcesses.get(i);
+ if (allChanged || app.setAdjChanged) {
+ app.setProcessTrackerState(TOP_APP, memFactor, now, mProcessList);
+ }
+ }
+ }
+
+ if (DEBUG_OOM_ADJ) {
+ Slog.d(TAG, "Did OOM ADJ in " + (SystemClock.uptimeMillis()-now) + "ms");
+ }
}
final void trimApplications() {
diff --git a/services/java/com/android/server/am/ActivityStackSupervisor.java b/services/java/com/android/server/am/ActivityStackSupervisor.java
index af61bfb..ba8de39 100644
--- a/services/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/java/com/android/server/am/ActivityStackSupervisor.java
@@ -69,6 +69,7 @@
import android.util.SparseArray;
import com.android.internal.app.HeavyWeightSwitcherActivity;
+import com.android.internal.os.TransferPipe;
import com.android.server.am.ActivityManagerService.PendingActivityLaunch;
import com.android.server.am.ActivityStack.ActivityState;
import com.android.server.wm.StackBox;
@@ -986,7 +987,7 @@
if (app != null && app.thread != null) {
try {
- app.addPackage(r.info.packageName);
+ app.addPackage(r.info.packageName, mService.mProcessTracker);
realStartActivityLocked(r, app, andResume, checkConfig);
return;
} catch (RemoteException e) {
diff --git a/services/java/com/android/server/am/BatteryStatsService.java b/services/java/com/android/server/am/BatteryStatsService.java
index 5a15f0b..f143feb 100644
--- a/services/java/com/android/server/am/BatteryStatsService.java
+++ b/services/java/com/android/server/am/BatteryStatsService.java
@@ -27,6 +27,7 @@
import android.os.Parcel;
import android.os.Process;
import android.os.ServiceManager;
+import android.os.UserHandle;
import android.os.WorkSource;
import android.telephony.SignalStrength;
import android.telephony.TelephonyManager;
@@ -479,12 +480,13 @@
private void dumpHelp(PrintWriter pw) {
pw.println("Battery stats (batteryinfo) dump options:");
- pw.println(" [--checkin] [--unplugged] [--reset] [--write] [-h]");
+ pw.println(" [--checkin] [--unplugged] [--reset] [--write] [-h] [<package.name>]");
pw.println(" --checkin: format output for a checkin report.");
pw.println(" --unplugged: only output data since last unplugged.");
pw.println(" --reset: reset the stats, clearing all current data.");
pw.println(" --write: force write current collected stats to disk.");
pw.println(" -h: print this help text.");
+ pw.println(" <package.name>: optional name of package to filter output by.");
}
@Override
@@ -500,6 +502,7 @@
boolean isCheckin = false;
boolean isUnpluggedOnly = false;
boolean noOutput = false;
+ int reqUid = -1;
if (args != null) {
for (String arg : args) {
if ("--checkin".equals(arg)) {
@@ -523,9 +526,20 @@
return;
} else if ("-a".equals(arg)) {
// fall through
- } else {
+ } else if (arg.length() > 0 && arg.charAt(0) == '-'){
pw.println("Unknown option: " + arg);
dumpHelp(pw);
+ return;
+ } else {
+ // Not an option, last argument must be a package name.
+ try {
+ reqUid = mContext.getPackageManager().getPackageUid(arg,
+ UserHandle.getCallingUserId());
+ } catch (PackageManager.NameNotFoundException e) {
+ pw.println("Unknown package: " + arg);
+ dumpHelp(pw);
+ return;
+ }
}
}
}
@@ -539,7 +553,7 @@
}
} else {
synchronized (mStats) {
- mStats.dumpLocked(pw, isUnpluggedOnly);
+ mStats.dumpLocked(pw, isUnpluggedOnly, reqUid);
}
}
}
diff --git a/services/java/com/android/server/am/BroadcastQueue.java b/services/java/com/android/server/am/BroadcastQueue.java
index c7e6010..0e7513c 100644
--- a/services/java/com/android/server/am/BroadcastQueue.java
+++ b/services/java/com/android/server/am/BroadcastQueue.java
@@ -795,7 +795,7 @@
info.activityInfo.applicationInfo.uid);
if (app != null && app.thread != null) {
try {
- app.addPackage(info.activityInfo.packageName);
+ app.addPackage(info.activityInfo.packageName, mService.mProcessTracker);
processCurBroadcastLocked(r, app);
return;
} catch (RemoteException e) {
diff --git a/services/java/com/android/server/am/CompatModePackages.java b/services/java/com/android/server/am/CompatModePackages.java
index f56371c..59e6787 100644
--- a/services/java/com/android/server/am/CompatModePackages.java
+++ b/services/java/com/android/server/am/CompatModePackages.java
@@ -300,7 +300,7 @@
// Tell all processes that loaded this package about the change.
for (int i=mService.mLruProcesses.size()-1; i>=0; i--) {
ProcessRecord app = mService.mLruProcesses.get(i);
- if (!app.pkgList.contains(packageName)) {
+ if (!app.pkgList.containsKey(packageName)) {
continue;
}
try {
diff --git a/services/java/com/android/server/am/ProcessList.java b/services/java/com/android/server/am/ProcessList.java
index e937d35..b5d783d 100644
--- a/services/java/com/android/server/am/ProcessList.java
+++ b/services/java/com/android/server/am/ProcessList.java
@@ -244,7 +244,7 @@
}
int adjToTrackedState(int adj) {
- return mAdjToTrackedState[adj];
+ return adj >= FOREGROUND_APP_ADJ ? mAdjToTrackedState[adj] : ProcessTracker.STATE_NOTHING;
}
private void writeFile(String path, String data) {
diff --git a/services/java/com/android/server/am/ProcessRecord.java b/services/java/com/android/server/am/ProcessRecord.java
index 6cae67c..cc0a5a3 100644
--- a/services/java/com/android/server/am/ProcessRecord.java
+++ b/services/java/com/android/server/am/ProcessRecord.java
@@ -51,9 +51,10 @@
final int uid; // uid of process; may be different from 'info' if isolated
final int userId; // user of process.
final String processName; // name of the process
- final ProcessTracker.ProcessState tracker; // tracking execution of process
+ final ProcessTracker.ProcessState baseProcessTracker;
// List of packages running in the process
- final HashSet<String> pkgList = new HashSet<String>();
+ final ArrayMap<String, ProcessTracker.ProcessState> pkgList
+ = new ArrayMap<String, ProcessTracker.ProcessState>();
IApplicationThread thread; // the actual proc... may be null only if
// 'persistent' is true (in which case we
// are in the process of launching the app)
@@ -87,6 +88,7 @@
boolean hasAboveClient; // Bound using BIND_ABOVE_CLIENT, so want to be lower
boolean bad; // True if disabled in the bad process list
boolean killedBackground; // True when proc has been killed due to too many bg
+ boolean setAdjChanged; // Keep track of whether we changed 'setAdj'.
String waitingToKill; // Process is waiting to be killed when in the bg; reason
IBinder forcingToForeground;// Token that is forcing this process to be foreground
int adjSeq; // Sequence id for identifying oom_adj assignment cycles
@@ -327,15 +329,15 @@
ProcessRecord(BatteryStatsImpl.Uid.Proc _batteryStats, IApplicationThread _thread,
ApplicationInfo _info, String _processName, int _uid,
- ProcessTracker.ProcessState _tracker) {
+ ProcessTracker.ProcessState tracker) {
batteryStats = _batteryStats;
info = _info;
isolated = _info.uid != _uid;
uid = _uid;
userId = UserHandle.getUserId(_uid);
processName = _processName;
- tracker = _tracker;
- pkgList.add(_info.packageName);
+ baseProcessTracker = tracker;
+ pkgList.put(_info.packageName, tracker);
thread = _thread;
maxAdj = ProcessList.CACHED_APP_MAX_ADJ;
cachedAdj = clientCachedAdj = emptyAdj = ProcessList.CACHED_APP_MIN_ADJ;
@@ -437,20 +439,33 @@
/*
* Return true if package has been added false if not
*/
- public boolean addPackage(String pkg) {
- if (!pkgList.contains(pkg)) {
- pkgList.add(pkg);
+ public boolean addPackage(String pkg, ProcessTracker tracker) {
+ if (!pkgList.containsKey(pkg)) {
+ pkgList.put(pkg, tracker.getProcessStateLocked(pkg, info.uid, processName));
return true;
}
return false;
}
-
+
+ public void setProcessTrackerState(ProcessRecord TOP_APP, int memFactor, long now,
+ ProcessList plist) {
+ int state = this == TOP_APP ? ProcessTracker.STATE_TOP
+ : plist.adjToTrackedState(setAdj);
+ for (int ip=pkgList.size()-1; ip>=0; ip--) {
+ pkgList.valueAt(ip).setState(state, memFactor, now);
+ }
+ }
+
/*
* Delete all packages from list except the package indicated in info
*/
public void resetPackageList() {
+ long now = SystemClock.uptimeMillis();
+ for (int i=0; i<pkgList.size(); i++) {
+ pkgList.valueAt(i).setState(ProcessTracker.STATE_NOTHING, 0, now);
+ }
pkgList.clear();
- pkgList.add(info.packageName);
+ pkgList.put(info.packageName, baseProcessTracker);
}
public String[] getPackageList() {
@@ -459,7 +474,9 @@
return null;
}
String list[] = new String[size];
- pkgList.toArray(list);
+ for (int i=0; i<pkgList.size(); i++) {
+ list[i] = pkgList.keyAt(i);
+ }
return list;
}
}
diff --git a/services/java/com/android/server/am/ProcessTracker.java b/services/java/com/android/server/am/ProcessTracker.java
index 4eb71c7..fb8d09c 100644
--- a/services/java/com/android/server/am/ProcessTracker.java
+++ b/services/java/com/android/server/am/ProcessTracker.java
@@ -36,7 +36,15 @@
public static final int STATE_HOME = 6;
public static final int STATE_PREVIOUS = 7;
public static final int STATE_CACHED = 8;
- public static final int STATE_SCREEN_ON_MOD = STATE_CACHED+1;
+ public static final int STATE_MEM_FACTOR_MOD = STATE_CACHED+1;
+ public static final int STATE_MEM_FACTOR_NORMAL_ADJ = 0;
+ public static final int STATE_MEM_FACTOR_MODERATE_ADJ = STATE_MEM_FACTOR_MOD;
+ public static final int STATE_MEM_FACTOR_LOW_ADJ = STATE_MEM_FACTOR_MOD*2;
+ public static final int STATE_MEM_FACTOR_CRITIAL_ADJ = STATE_MEM_FACTOR_MOD*3;
+ public static final int STATE_MEM_FACTOR_COUNT = STATE_MEM_FACTOR_MOD*4;
+ public static final int STATE_SCREEN_ON_MOD = STATE_MEM_FACTOR_COUNT;
+ public static final int STATE_SCREEN_OFF_ADJ = 0;
+ public static final int STATE_SCREEN_ON_ADJ = STATE_SCREEN_ON_MOD;
public static final int STATE_COUNT = STATE_SCREEN_ON_MOD*2;
static String[] STATE_NAMES = new String[] {
@@ -45,21 +53,44 @@
};
public static final class ProcessState {
- final long[] mTimes = new long[STATE_COUNT];
+ final long[] mDurations = new long[STATE_COUNT];
int mCurState = STATE_NOTHING;
long mStartTime;
- public void setState(int state, long now) {
- if (mCurState != STATE_NOTHING) {
- mTimes[mCurState] += now - mStartTime;
+ public void setState(int state, int memFactor, long now) {
+ if (state != STATE_NOTHING) {
+ state += memFactor;
}
- mCurState = state;
- mStartTime = now;
+ if (mCurState != state) {
+ if (mCurState != STATE_NOTHING) {
+ mDurations[mCurState] += now - mStartTime;
+ }
+ mCurState = state;
+ mStartTime = now;
+ }
+ }
+ }
+
+ public static final class ServiceState {
+ long mStartedDuration;
+ long mStartedTime;
+ }
+
+ public static final class PackageState {
+ final ArrayMap<String, ProcessState> mProcesses = new ArrayMap<String, ProcessState>();
+ final ArrayMap<String, ServiceState> mServices = new ArrayMap<String, ServiceState>();
+ final int mUid;
+
+ public PackageState(int uid) {
+ mUid = uid;
}
}
static final class State {
- final ProcessMap<ProcessState> mProcesses = new ProcessMap<ProcessState>();
+ final ProcessMap<PackageState> mPackages = new ProcessMap<PackageState>();
+ final long[] mMemFactorDurations = new long[STATE_COUNT/STATE_MEM_FACTOR_MOD];
+ int mMemFactor = STATE_NOTHING;
+ long mStartTime;
}
final State mState = new State();
@@ -67,44 +98,198 @@
public ProcessTracker() {
}
- public ProcessState getStateLocked(String name, int uid) {
- ProcessState ps = mState.mProcesses.get(name, uid);
+ private PackageState getPackageStateLocked(String packageName, int uid) {
+ PackageState as = mState.mPackages.get(packageName, uid);
+ if (as != null) {
+ return as;
+ }
+ as = new PackageState(uid);
+ mState.mPackages.put(packageName, uid, as);
+ return as;
+ }
+
+ public ProcessState getProcessStateLocked(String packageName, int uid, String processName) {
+ final PackageState as = getPackageStateLocked(packageName, uid);
+ ProcessState ps = as.mProcesses.get(processName);
if (ps != null) {
return ps;
}
ps = new ProcessState();
- mState.mProcesses.put(name, uid, ps);
+ as.mProcesses.put(processName, ps);
return ps;
}
+ public ServiceState getServiceStateLocked(String packageName, int uid, String className) {
+ final PackageState as = getPackageStateLocked(packageName, uid);
+ ServiceState ss = as.mServices.get(className);
+ if (ss != null) {
+ return ss;
+ }
+ ss = new ServiceState();
+ as.mServices.put(className, ss);
+ return ss;
+ }
+
+ public boolean setMemFactor(int memFactor, boolean screenOn, long now) {
+ if (screenOn) {
+ memFactor += STATE_SCREEN_ON_MOD;
+ }
+ if (memFactor != mState.mMemFactor) {
+ if (mState.mMemFactor != STATE_NOTHING) {
+ mState.mMemFactorDurations[mState.mMemFactor/STATE_MEM_FACTOR_MOD]
+ += now - mState.mStartTime;
+ }
+ mState.mMemFactor = memFactor;
+ mState.mStartTime = now;
+ return true;
+ }
+ return false;
+ }
+
+ public int getMemFactor() {
+ return mState.mMemFactor != STATE_NOTHING ? mState.mMemFactor : 0;
+ }
+
+ private void printScreenLabel(PrintWriter pw, int offset) {
+ switch (offset) {
+ case STATE_NOTHING:
+ pw.print(" ");
+ break;
+ case STATE_SCREEN_OFF_ADJ:
+ pw.print("Screen Off / ");
+ break;
+ case STATE_SCREEN_ON_ADJ:
+ pw.print("Screen On / ");
+ break;
+ default:
+ pw.print("?????????? / ");
+ break;
+ }
+ }
+
+ private void printMemLabel(PrintWriter pw, int offset) {
+ switch (offset) {
+ case STATE_NOTHING:
+ pw.print(" ");
+ break;
+ case STATE_MEM_FACTOR_NORMAL_ADJ:
+ pw.print("Norm / ");
+ break;
+ case STATE_MEM_FACTOR_MODERATE_ADJ:
+ pw.print("Mod / ");
+ break;
+ case STATE_MEM_FACTOR_LOW_ADJ:
+ pw.print("Low / ");
+ break;
+ case STATE_MEM_FACTOR_CRITIAL_ADJ:
+ pw.print("Crit / ");
+ break;
+ default:
+ pw.print("???? / ");
+ break;
+ }
+ }
+
public void dumpLocked(FileDescriptor fd, PrintWriter pw, String[] args) {
final long now = SystemClock.uptimeMillis();
- ArrayMap<String, SparseArray<ProcessState>> pmap = mState.mProcesses.getMap();
+ ArrayMap<String, SparseArray<PackageState>> pmap = mState.mPackages.getMap();
+ pw.println("Process Stats:");
for (int ip=0; ip<pmap.size(); ip++) {
String procName = pmap.keyAt(ip);
- SparseArray<ProcessState> procs = pmap.valueAt(ip);
+ SparseArray<PackageState> procs = pmap.valueAt(ip);
for (int iu=0; iu<procs.size(); iu++) {
int uid = procs.keyAt(iu);
- ProcessState state = procs.valueAt(iu);
+ PackageState state = procs.valueAt(iu);
pw.print(" "); pw.print(procName); pw.print(" / "); pw.print(uid); pw.println(":");
- long totalTime = 0;
- for (int is=0; is<STATE_NAMES.length; is++) {
- long time = state.mTimes[is];
- if (state.mCurState == is) {
- time += now - state.mStartTime;
+ for (int iproc=0; iproc<state.mProcesses.size(); iproc++) {
+ pw.print(" Process ");
+ pw.print(state.mProcesses.keyAt(iproc));
+ pw.println(":");
+ long totalTime = 0;
+ ProcessState proc = state.mProcesses.valueAt(iproc);
+ int printedScreen = -1;
+ for (int iscreen=0; iscreen<STATE_COUNT; iscreen+=STATE_SCREEN_ON_MOD) {
+ int printedMem = -1;
+ for (int imem=0; imem<STATE_MEM_FACTOR_COUNT; imem+=STATE_MEM_FACTOR_MOD) {
+ for (int is=0; is<STATE_NAMES.length; is++) {
+ int bucket = is+imem+iscreen;
+ long time = proc.mDurations[bucket];
+ String running = "";
+ if (proc.mCurState == bucket) {
+ time += now - proc.mStartTime;
+ running = " (running)";
+ }
+ if (time != 0) {
+ pw.print(" ");
+ printScreenLabel(pw, printedScreen != iscreen
+ ? iscreen : STATE_NOTHING);
+ printedScreen = iscreen;
+ printMemLabel(pw, printedMem != imem ? imem : STATE_NOTHING);
+ printedMem = imem;
+ pw.print(STATE_NAMES[is]); pw.print(": ");
+ TimeUtils.formatDuration(time, pw); pw.println(running);
+ totalTime += time;
+ }
+ }
+ }
+ }
+ if (totalTime != 0) {
+ pw.print(" ");
+ printScreenLabel(pw, STATE_NOTHING);
+ printMemLabel(pw, STATE_NOTHING);
+ pw.print("TOTAL : ");
+ TimeUtils.formatDuration(totalTime, pw);
+ pw.println();
+ }
+ }
+ for (int isvc=0; isvc<state.mServices.size(); isvc++) {
+ pw.print(" Service ");
+ pw.print(state.mServices.keyAt(isvc));
+ pw.println(":");
+ ServiceState svc = state.mServices.valueAt(isvc);
+ long time = svc.mStartedDuration;
+ if (svc.mStartedTime >= 0) {
+ time += now - svc.mStartedTime;
}
if (time != 0) {
- pw.print(" "); pw.print(STATE_NAMES[is]); pw.print(": ");
+ pw.print(" Started: ");
TimeUtils.formatDuration(time, pw); pw.println();
- totalTime += time;
}
}
- if (totalTime != 0) {
- pw.print(" TOTAL : ");
- TimeUtils.formatDuration(totalTime, pw);
- pw.println();
+ }
+ }
+ pw.println();
+ pw.println("Run time Stats:");
+ long totalTime = 0;
+ int printedScreen = -1;
+ for (int iscreen=0; iscreen<STATE_COUNT; iscreen+=STATE_SCREEN_ON_MOD) {
+ int printedMem = -1;
+ for (int imem=0; imem<STATE_MEM_FACTOR_COUNT; imem+=STATE_MEM_FACTOR_MOD) {
+ int bucket = imem+iscreen;
+ long time = mState.mMemFactorDurations[bucket/STATE_MEM_FACTOR_MOD];
+ String running = "";
+ if (mState.mMemFactor == bucket) {
+ time += now - mState.mStartTime;
+ running = " (running)";
+ }
+ if (time != 0) {
+ pw.print(" ");
+ printScreenLabel(pw, printedScreen != iscreen
+ ? iscreen : STATE_NOTHING);
+ printedScreen = iscreen;
+ printMemLabel(pw, printedMem != imem ? imem : STATE_NOTHING);
+ printedMem = imem;
+ TimeUtils.formatDuration(time, pw); pw.println(running);
+ totalTime += time;
}
}
}
+ if (totalTime != 0) {
+ pw.print(" ");
+ printScreenLabel(pw, STATE_NOTHING);
+ pw.print("TOTAL: ");
+ TimeUtils.formatDuration(totalTime, pw);
+ pw.println();
+ }
}
}
diff --git a/services/java/com/android/server/am/ProviderMap.java b/services/java/com/android/server/am/ProviderMap.java
index 5759a44..7da8c48 100644
--- a/services/java/com/android/server/am/ProviderMap.java
+++ b/services/java/com/android/server/am/ProviderMap.java
@@ -22,6 +22,7 @@
import android.os.UserHandle;
import android.util.Slog;
import android.util.SparseArray;
+import com.android.internal.os.TransferPipe;
import java.io.FileDescriptor;
import java.io.IOException;
diff --git a/services/java/com/android/server/pm/KeySetManager.java b/services/java/com/android/server/pm/KeySetManager.java
index f154ab3..8272c15 100644
--- a/services/java/com/android/server/pm/KeySetManager.java
+++ b/services/java/com/android/server/pm/KeySetManager.java
@@ -399,24 +399,50 @@
return new String(Base64.encode(k.getEncoded(), 0));
}
- public void dump(PrintWriter pw) {
+ public void dump(PrintWriter pw, String packageName,
+ PackageManagerService.DumpState dumpState) {
synchronized (mLockObject) {
- pw.println(" Dumping KeySetManager");
+ boolean printedHeader = false;
for (Map.Entry<String, PackageSetting> e : mPackages.entrySet()) {
- String packageName = e.getKey();
+ String keySetPackage = e.getKey();
+ if (packageName != null && !packageName.equals(keySetPackage)) {
+ continue;
+ }
+ if (!printedHeader) {
+ if (dumpState.onTitlePrinted())
+ pw.println();
+ pw.println("Key Set Manager:");
+ printedHeader = true;
+ }
PackageSetting pkg = e.getValue();
- pw.print(" ["); pw.print(packageName); pw.println("]");
+ pw.print(" ["); pw.print(keySetPackage); pw.println("]");
if (pkg.keySetData != null) {
- pw.print(" Defined KeySets:");
+ boolean printedLabel = false;
for (long keySetId : pkg.keySetData.getDefinedKeySets()) {
- pw.print(" "); pw.print(Long.toString(keySetId));
+ if (!printedLabel) {
+ pw.print(" Defined KeySets: ");
+ printedLabel = true;
+ } else {
+ pw.print(", ");
+ }
+ pw.print(Long.toString(keySetId));
}
- pw.println("");
- pw.print(" Signing KeySets:");
+ if (printedLabel) {
+ pw.println("");
+ }
+ printedLabel = false;
for (long keySetId : pkg.keySetData.getSigningKeySets()) {
+ if (!printedLabel) {
+ pw.print(" Signing KeySets:");
+ printedLabel = true;
+ } else {
+ pw.print(", ");
+ }
pw.print(" "); pw.print(Long.toString(keySetId));
}
- pw.println("");
+ if (printedLabel) {
+ pw.println("");
+ }
}
}
}
diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java
index 07805f9..5e6e055 100644
--- a/services/java/com/android/server/pm/PackageManagerService.java
+++ b/services/java/com/android/server/pm/PackageManagerService.java
@@ -10041,6 +10041,9 @@
// Is this a package name?
if ("android".equals(cmd) || cmd.contains(".")) {
packageName = cmd;
+ // When dumping a single package, we always dump all of its
+ // filter information since the amount of data will be reasonable.
+ dumpState.setOptionEnabled(DumpState.OPTION_SHOW_FILTERS);
} else if ("l".equals(cmd) || "libraries".equals(cmd)) {
dumpState.setDump(DumpState.DUMP_LIBS);
} else if ("f".equals(cmd) || "features".equals(cmd)) {
@@ -10076,7 +10079,7 @@
synchronized (mPackages) {
if (dumpState.isDumping(DumpState.DUMP_VERIFIERS) && packageName == null) {
if (dumpState.onTitlePrinted())
- pw.println(" ");
+ pw.println();
pw.println("Verifiers:");
pw.print(" Required: ");
pw.print(mRequiredVerifierPackage);
@@ -10086,16 +10089,20 @@
}
if (dumpState.isDumping(DumpState.DUMP_LIBS) && packageName == null) {
- if (dumpState.onTitlePrinted())
- pw.println(" ");
- pw.println("Libraries:");
+ boolean printedHeader = false;
final Iterator<String> it = mSharedLibraries.keySet().iterator();
while (it.hasNext()) {
String name = it.next();
+ SharedLibraryEntry ent = mSharedLibraries.get(name);
+ if (!printedHeader) {
+ if (dumpState.onTitlePrinted())
+ pw.println();
+ pw.println("Libraries:");
+ printedHeader = true;
+ }
pw.print(" ");
pw.print(name);
pw.print(" -> ");
- SharedLibraryEntry ent = mSharedLibraries.get(name);
if (ent.path != null) {
pw.print("(jar) ");
pw.print(ent.path);
@@ -10109,7 +10116,7 @@
if (dumpState.isDumping(DumpState.DUMP_FEATURES) && packageName == null) {
if (dumpState.onTitlePrinted())
- pw.println(" ");
+ pw.println();
pw.println("Features:");
Iterator<String> it = mAvailableFeatures.keySet().iterator();
while (it.hasNext()) {
@@ -10185,7 +10192,7 @@
}
if (!printedSomething) {
if (dumpState.onTitlePrinted())
- pw.println(" ");
+ pw.println();
pw.println("Registered ContentProviders:");
printedSomething = true;
}
@@ -10200,7 +10207,7 @@
}
if (!printedSomething) {
if (dumpState.onTitlePrinted())
- pw.println(" ");
+ pw.println();
pw.println("ContentProvider Authorities:");
printedSomething = true;
}
@@ -10214,10 +10221,7 @@
}
if (dumpState.isDumping(DumpState.DUMP_KEYSETS)) {
- if (dumpState.onTitlePrinted()) {
- pw.println(" ");
- }
- mSettings.mKeySetManager.dump(pw);
+ mSettings.mKeySetManager.dump(pw, packageName, dumpState);
}
if (dumpState.isDumping(DumpState.DUMP_PACKAGES)) {
@@ -10230,10 +10234,10 @@
if (dumpState.isDumping(DumpState.DUMP_MESSAGES) && packageName == null) {
if (dumpState.onTitlePrinted())
- pw.println(" ");
+ pw.println();
mSettings.dumpReadMessagesLPr(pw, dumpState);
- pw.println(" ");
+ pw.println();
pw.println("Package warning messages:");
final File fname = getSettingsProblemFile();
FileInputStream in = null;
diff --git a/services/java/com/android/server/pm/Settings.java b/services/java/com/android/server/pm/Settings.java
index a9c2ea1..b7810ba 100644
--- a/services/java/com/android/server/pm/Settings.java
+++ b/services/java/com/android/server/pm/Settings.java
@@ -2893,7 +2893,7 @@
if (!printedSomething) {
if (dumpState.onTitlePrinted())
- pw.println(" ");
+ pw.println();
pw.println("Packages:");
printedSomething = true;
}
@@ -2909,7 +2909,7 @@
}
if (!printedSomething) {
if (dumpState.onTitlePrinted())
- pw.println(" ");
+ pw.println();
pw.println("Renamed packages:");
printedSomething = true;
}
@@ -2929,7 +2929,7 @@
}
if (!printedSomething) {
if (dumpState.onTitlePrinted())
- pw.println(" ");
+ pw.println();
pw.println("Hidden system packages:");
printedSomething = true;
}
@@ -2946,7 +2946,7 @@
}
if (!printedSomething) {
if (dumpState.onTitlePrinted())
- pw.println(" ");
+ pw.println();
pw.println("Permissions:");
printedSomething = true;
}
@@ -2980,7 +2980,7 @@
}
if (!printedSomething) {
if (dumpState.onTitlePrinted())
- pw.println(" ");
+ pw.println();
pw.println("Shared users:");
printedSomething = true;
}
diff --git a/services/java/com/android/server/usb/UsbDeviceManager.java b/services/java/com/android/server/usb/UsbDeviceManager.java
index 3a5357a..5a60de0 100644
--- a/services/java/com/android/server/usb/UsbDeviceManager.java
+++ b/services/java/com/android/server/usb/UsbDeviceManager.java
@@ -56,6 +56,7 @@
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Scanner;
@@ -240,7 +241,7 @@
for (int i = 0; i < serialLength; i++) {
address[i % (ETH_ALEN - 1) + 1] ^= (int)serial.charAt(i);
}
- String addrString = String.format("%02X:%02X:%02X:%02X:%02X:%02X",
+ String addrString = String.format(Locale.US, "%02X:%02X:%02X:%02X:%02X:%02X",
address[0], address[1], address[2], address[3], address[4], address[5]);
try {
FileUtils.stringToFile(RNDIS_ETH_ADDR_PATH, addrString);
diff --git a/tests/ActivityTests/src/com/google/android/test/activity/ArrayMapTests.java b/tests/ActivityTests/src/com/google/android/test/activity/ArrayMapTests.java
index 7d82cd3..9b54927 100644
--- a/tests/ActivityTests/src/com/google/android/test/activity/ArrayMapTests.java
+++ b/tests/ActivityTests/src/com/google/android/test/activity/ArrayMapTests.java
@@ -17,10 +17,12 @@
package com.google.android.test.activity;
import android.util.ArrayMap;
+import android.util.ArraySet;
import android.util.Log;
import java.util.Collection;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
@@ -137,41 +139,35 @@
}
}
+ return true;
+ }
+
+ private static boolean compareSets(HashSet set, ArraySet array) {
+ if (set.size() != array.size()) {
+ Log.e("test", "Bad size: expected " + set.size() + ", got " + array.size());
+ return false;
+ }
+
+ for (Object entry : set) {
+ if (!array.contains(entry)) {
+ Log.e("test", "Bad value: expected " + entry + " not found in ArraySet");
+ return false;
+ }
+ }
+
+ for (int i=0; i<array.size(); i++) {
+ Object entry = array.valueAt(i);
+ if (!set.contains(entry)) {
+ Log.e("test", "Bad value: unexpected " + entry + " in ArraySet");
+ return false;
+ }
+ }
+
int index = 0;
- for (Object entry : array.entrySet()) {
- Object key = ((Map.Entry)entry).getKey();
- Object value = ((Map.Entry)entry).getValue();
- Object realKey = array.keyAt(index);
- Object realValue = array.valueAt(index);
- if (!compare(key, realKey)) {
- Log.e("test", "Bad entry iterator: expected key " + realKey + ", got " + key
- + " at index " + index);
- return false;
- }
- if (!compare(value, realValue)) {
- Log.e("test", "Bad entry iterator: expected value " + realValue + ", got " + value
- + " at index " + index);
- return false;
- }
- index++;
- }
-
- index = 0;
- for (Object key : array.keySet()) {
- Object realKey = array.keyAt(index);
- if (!compare(key, realKey)) {
- Log.e("test", "Bad key iterator: expected key " + realKey + ", got " + key
- + " at index " + index);
- return false;
- }
- index++;
- }
-
- index = 0;
- for (Object value : array.values()) {
- Object realValue = array.valueAt(index);
- if (!compare(value, realValue)) {
- Log.e("test", "Bad value iterator: expected value " + realValue + ", got " + value
+ for (Object entry : array) {
+ Object realEntry = array.valueAt(index);
+ if (!compare(entry, realEntry)) {
+ Log.e("test", "Bad iterator: expected value " + realEntry + ", got " + entry
+ " at index " + index);
return false;
}
@@ -190,14 +186,14 @@
Object value = entry.getKey();
Object realValue = array.keyAt(index);
if (!compare(realValue, value)) {
- Log.e("test", "Bad hash array entry set: expected key " + realValue
+ Log.e("test", "Bad array map entry set: expected key " + realValue
+ ", got " + value + " at index " + index);
return false;
}
value = entry.getValue();
realValue = array.valueAt(index);
if (!compare(realValue, value)) {
- Log.e("test", "Bad hash array entry set: expected value " + realValue
+ Log.e("test", "Bad array map entry set: expected value " + realValue
+ ", got " + value + " at index " + index);
return false;
}
@@ -211,7 +207,7 @@
Object value = keyIt.next();
Object realValue = array.keyAt(index);
if (!compare(realValue, value)) {
- Log.e("test", "Bad hash array key set: expected key " + realValue
+ Log.e("test", "Bad array map key set: expected key " + realValue
+ ", got " + value + " at index " + index);
return false;
}
@@ -225,7 +221,7 @@
Object value = valueIt.next();
Object realValue = array.valueAt(index);
if (!compare(realValue, value)) {
- Log.e("test", "Bad hash array value col: expected value " + realValue
+ Log.e("test", "Bad array map value col: expected value " + realValue
+ ", got " + value + " at index " + index);
return false;
}
@@ -235,7 +231,7 @@
return true;
}
- private static void dump(HashMap map, ArrayMap array) {
+ private static void dump(Map map, ArrayMap array) {
Log.e("test", "HashMap of " + map.size() + " entries:");
Set<Map.Entry> mapSet = map.entrySet();
for (Map.Entry entry : mapSet) {
@@ -247,6 +243,17 @@
}
}
+ private static void dump(Set set, ArraySet array) {
+ Log.e("test", "HashSet of " + set.size() + " entries:");
+ for (Object entry : set) {
+ Log.e("test", " " + entry);
+ }
+ Log.e("test", "ArraySet of " + array.size() + " entries:");
+ for (int i=0; i<array.size(); i++) {
+ Log.e("test", " " + array.valueAt(i));
+ }
+ }
+
private static void dump(ArrayMap map1, ArrayMap map2) {
Log.e("test", "ArrayMap of " + map1.size() + " entries:");
Set<Map.Entry> mapSet = map1.entrySet();
@@ -260,60 +267,93 @@
}
public static void run() {
- HashMap<ControlledHash, Integer> mHashMap = new HashMap<ControlledHash, Integer>();
- ArrayMap<ControlledHash, Integer> mArrayMap = new ArrayMap<ControlledHash, Integer>();
+ HashMap<ControlledHash, Integer> hashMap = new HashMap<ControlledHash, Integer>();
+ ArrayMap<ControlledHash, Integer> arrayMap = new ArrayMap<ControlledHash, Integer>();
+ HashSet<ControlledHash> hashSet = new HashSet<ControlledHash>();
+ ArraySet<ControlledHash> arraySet = new ArraySet<ControlledHash>();
for (int i=0; i<OPS.length; i++) {
- Integer oldMap;
+ Integer oldHash;
Integer oldArray;
+ boolean hashChanged;
+ boolean arrayChanged;
switch (OPS[i]) {
case OP_ADD:
Log.i("test", "Adding key: " + KEYS[i]);
- oldMap = mHashMap.put(new ControlledHash(KEYS[i]), i);
- oldArray = mArrayMap.put(new ControlledHash(KEYS[i]), i);
+ oldHash = hashMap.put(new ControlledHash(KEYS[i]), i);
+ oldArray = arrayMap.put(new ControlledHash(KEYS[i]), i);
+ hashChanged = hashSet.add(new ControlledHash(KEYS[i]));
+ arrayChanged = arraySet.add(new ControlledHash(KEYS[i]));
break;
case OP_REM:
Log.i("test", "Removing key: " + KEYS[i]);
- oldMap = mHashMap.remove(new ControlledHash(KEYS[i]));
- oldArray = mArrayMap.remove(new ControlledHash(KEYS[i]));
+ oldHash = hashMap.remove(new ControlledHash(KEYS[i]));
+ oldArray = arrayMap.remove(new ControlledHash(KEYS[i]));
+ hashChanged = hashSet.remove(new ControlledHash(KEYS[i]));
+ arrayChanged = arraySet.remove(new ControlledHash(KEYS[i]));
break;
default:
Log.e("test", "Bad operation " + OPS[i] + " @ " + i);
return;
}
- if (!compare(oldMap, oldArray)) {
- Log.e("test", "Bad result: expected " + oldMap + ", got " + oldArray);
- dump(mHashMap, mArrayMap);
+ if (!compare(oldHash, oldArray)) {
+ Log.e("test", "Bad result: expected " + oldHash + ", got " + oldArray);
+ dump(hashMap, arrayMap);
return;
}
- if (!validateArrayMap(mArrayMap)) {
- dump(mHashMap, mArrayMap);
+ if (hashChanged != arrayChanged) {
+ Log.e("test", "Bad change: expected " + hashChanged + ", got " + arrayChanged);
+ dump(hashSet, arraySet);
return;
}
- if (!compareMaps(mHashMap, mArrayMap)) {
- dump(mHashMap, mArrayMap);
+ if (!validateArrayMap(arrayMap)) {
+ dump(hashMap, arrayMap);
+ return;
+ }
+ if (!compareMaps(hashMap, arrayMap)) {
+ dump(hashMap, arrayMap);
+ return;
+ }
+ if (!compareSets(hashSet, arraySet)) {
+ dump(hashSet, arraySet);
return;
}
}
- mArrayMap.put(new ControlledHash(50000), 100);
+ arrayMap.put(new ControlledHash(50000), 100);
ControlledHash lookup = new ControlledHash(50000);
- Iterator<ControlledHash> it = mArrayMap.keySet().iterator();
+ Iterator<ControlledHash> it = arrayMap.keySet().iterator();
while (it.hasNext()) {
if (it.next().equals(lookup)) {
it.remove();
}
}
- if (mArrayMap.containsKey(lookup)) {
- Log.e("test", "Bad iterator: didn't remove test key");
- dump(mHashMap, mArrayMap);
+ if (arrayMap.containsKey(lookup)) {
+ Log.e("test", "Bad map iterator: didn't remove test key");
+ dump(hashMap, arrayMap);
}
- if (!equalsTest()) {
+ arraySet.add(new ControlledHash(50000));
+ it = arraySet.iterator();
+ while (it.hasNext()) {
+ if (it.next().equals(lookup)) {
+ it.remove();
+ }
+ }
+ if (arraySet.contains(lookup)) {
+ Log.e("test", "Bad set iterator: didn't remove test key");
+ dump(hashSet, arraySet);
+ }
+
+ if (!equalsMapTest()) {
return;
}
- // copy constructor test
+ if (!equalsSetTest()) {
+ return;
+ }
+
+ // map copy constructor test
ArrayMap newMap = new ArrayMap<Integer, String>();
for (int i = 0; i < 10; ++i) {
newMap.put(i, String.valueOf(i));
@@ -322,15 +362,31 @@
if (!compare(mapCopy, newMap)) {
Log.e("test", "ArrayMap copy constructor failure: expected " +
newMap + ", got " + mapCopy);
- dump(mHashMap, mArrayMap);
+ dump(newMap, mapCopy);
+ return;
+ }
+
+ // set copy constructor test
+ ArraySet newSet = new ArraySet<Integer>();
+ for (int i = 0; i < 10; ++i) {
+ newSet.add(i);
+ }
+ ArraySet setCopy = new ArraySet(newSet);
+ if (!compare(setCopy, newSet)) {
+ Log.e("test", "ArraySet copy constructor failure: expected " +
+ newSet + ", got " + setCopy);
+ dump(newSet, setCopy);
return;
}
Log.e("test", "Test successful; printing final map.");
- dump(mHashMap, mArrayMap);
+ dump(hashMap, arrayMap);
+
+ Log.e("test", "Test successful; printing final set.");
+ dump(hashSet, arraySet);
}
- private static boolean equalsTest() {
+ private static boolean equalsMapTest() {
ArrayMap<Integer, String> map1 = new ArrayMap<Integer, String>();
ArrayMap<Integer, String> map2 = new ArrayMap<Integer, String>();
HashMap<Integer, String> map3 = new HashMap<Integer, String>();
@@ -368,4 +424,42 @@
return true;
}
+
+ private static boolean equalsSetTest() {
+ ArraySet<Integer> set1 = new ArraySet<Integer>();
+ ArraySet<Integer> set2 = new ArraySet<Integer>();
+ HashSet<Integer> set3 = new HashSet<Integer>();
+ if (!compare(set1, set2) || !compare(set1, set3) || !compare(set3, set2)) {
+ Log.e("test", "ArraySet equals failure for empty sets " + set1 + ", " +
+ set2 + ", " + set3);
+ return false;
+ }
+
+ for (int i = 0; i < 10; ++i) {
+ set1.add(i);
+ set2.add(i);
+ set3.add(i);
+ }
+ if (!compare(set1, set2) || !compare(set1, set3) || !compare(set3, set2)) {
+ Log.e("test", "ArraySet equals failure for populated sets " + set1 + ", " +
+ set2 + ", " + set3);
+ return false;
+ }
+
+ set1.remove(0);
+ if (compare(set1, set2) || compare(set1, set3) || compare(set3, set1)) {
+ Log.e("test", "ArraSet equals failure for set size " + set1 + ", " +
+ set2 + ", " + set3);
+ return false;
+ }
+
+ set1.add(-1);
+ if (compare(set1, set2) || compare(set1, set3) || compare(set3, set1)) {
+ Log.e("test", "ArraySet equals failure for set contents " + set1 + ", " +
+ set2 + ", " + set3);
+ return false;
+ }
+
+ return true;
+ }
}
diff --git a/wifi/java/android/net/wifi/WifiSsid.java b/wifi/java/android/net/wifi/WifiSsid.java
index 55e9b2d..a35a34b 100644
--- a/wifi/java/android/net/wifi/WifiSsid.java
+++ b/wifi/java/android/net/wifi/WifiSsid.java
@@ -27,6 +27,7 @@
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CoderResult;
import java.nio.charset.CodingErrorAction;
+import java.util.Locale;
/**
* Stores SSID octets and handles conversion.
@@ -199,7 +200,7 @@
String out = "0x";
byte[] ssidbytes = getOctets();
for (int i = 0; i < octets.size(); i++) {
- out += String.format("%02x", ssidbytes[i]);
+ out += String.format(Locale.US, "%02x", ssidbytes[i]);
}
return out;
}
diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pWfdInfo.java b/wifi/java/android/net/wifi/p2p/WifiP2pWfdInfo.java
index 1ba991e..d65d03e 100644
--- a/wifi/java/android/net/wifi/p2p/WifiP2pWfdInfo.java
+++ b/wifi/java/android/net/wifi/p2p/WifiP2pWfdInfo.java
@@ -19,6 +19,8 @@
import android.os.Parcelable;
import android.os.Parcel;
+import java.util.Locale;
+
/**
* A class representing Wifi Display information for a device
* @hide
@@ -135,7 +137,8 @@
}
public String getDeviceInfoHex() {
- return String.format("%04x%04x%04x%04x", 6, mDeviceInfo, mCtrlPort, mMaxThroughput);
+ return String.format(
+ Locale.US, "%04x%04x%04x%04x", 6, mDeviceInfo, mCtrlPort, mMaxThroughput);
}
public String toString() {
diff --git a/wifi/java/android/net/wifi/p2p/nsd/WifiP2pDnsSdServiceInfo.java b/wifi/java/android/net/wifi/p2p/nsd/WifiP2pDnsSdServiceInfo.java
index bc1d3c6..cab817d 100644
--- a/wifi/java/android/net/wifi/p2p/nsd/WifiP2pDnsSdServiceInfo.java
+++ b/wifi/java/android/net/wifi/p2p/nsd/WifiP2pDnsSdServiceInfo.java
@@ -22,6 +22,7 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
/**
@@ -126,7 +127,7 @@
sb.append(" ");
byte[] data = instanceName.getBytes();
- sb.append(String.format("%02x", data.length));
+ sb.append(String.format(Locale.US, "%02x", data.length));
sb.append(WifiP2pServiceInfo.bin2HexStr(data));
// This is the start point of this response.
// Therefore, it indicates the request domain name.
@@ -186,8 +187,8 @@
dnsName = dnsName.toLowerCase();
}
sb.append(compressDnsName(dnsName));
- sb.append(String.format("%04x", dnsType));
- sb.append(String.format("%02x", version));
+ sb.append(String.format(Locale.US, "%04x", dnsType));
+ sb.append(String.format(Locale.US, "%02x", version));
return sb.toString();
}
@@ -214,7 +215,7 @@
int i = dnsName.indexOf('.');
if (i == -1) {
if (dnsName.length() > 0) {
- sb.append(String.format("%02x", dnsName.length()));
+ sb.append(String.format(Locale.US, "%02x", dnsName.length()));
sb.append(WifiP2pServiceInfo.bin2HexStr(dnsName.getBytes()));
}
// for a sequence of labels ending in a zero octet
@@ -224,7 +225,7 @@
String name = dnsName.substring(0, i);
dnsName = dnsName.substring(i + 1);
- sb.append(String.format("%02x", name.length()));
+ sb.append(String.format(Locale.US, "%02x", name.length()));
sb.append(WifiP2pServiceInfo.bin2HexStr(name.getBytes()));
}
return sb.toString();
diff --git a/wifi/java/android/net/wifi/p2p/nsd/WifiP2pServiceRequest.java b/wifi/java/android/net/wifi/p2p/nsd/WifiP2pServiceRequest.java
index c7f0e5f..81395c9 100644
--- a/wifi/java/android/net/wifi/p2p/nsd/WifiP2pServiceRequest.java
+++ b/wifi/java/android/net/wifi/p2p/nsd/WifiP2pServiceRequest.java
@@ -20,6 +20,8 @@
import android.os.Parcel;
import android.os.Parcelable;
+import java.util.Locale;
+
/**
* A class for creating a service discovery request for use with
* {@link WifiP2pManager#addServiceRequest} and {@link WifiP2pManager#removeServiceRequest}
@@ -134,10 +136,10 @@
public String getSupplicantQuery() {
StringBuffer sb = new StringBuffer();
// length is retained as little endian format.
- sb.append(String.format("%02x", (mLength) & 0xff));
- sb.append(String.format("%02x", (mLength >> 8) & 0xff));
- sb.append(String.format("%02x", mProtocolType));
- sb.append(String.format("%02x", mTransId));
+ sb.append(String.format(Locale.US, "%02x", (mLength) & 0xff));
+ sb.append(String.format(Locale.US, "%02x", (mLength >> 8) & 0xff));
+ sb.append(String.format(Locale.US, "%02x", mProtocolType));
+ sb.append(String.format(Locale.US, "%02x", mTransId));
if (mQuery != null) {
sb.append(mQuery);
}
diff --git a/wifi/java/android/net/wifi/p2p/nsd/WifiP2pUpnpServiceInfo.java b/wifi/java/android/net/wifi/p2p/nsd/WifiP2pUpnpServiceInfo.java
index 40a0d61..a4cdfd9 100644
--- a/wifi/java/android/net/wifi/p2p/nsd/WifiP2pUpnpServiceInfo.java
+++ b/wifi/java/android/net/wifi/p2p/nsd/WifiP2pUpnpServiceInfo.java
@@ -18,6 +18,7 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Locale;
import java.util.UUID;
/**
@@ -98,7 +99,7 @@
private static String createSupplicantQuery(String uuid, String data) {
StringBuffer sb = new StringBuffer();
sb.append("upnp ");
- sb.append(String.format("%02x ", VERSION_1_0));
+ sb.append(String.format(Locale.US, "%02x ", VERSION_1_0));
sb.append("uuid:");
sb.append(uuid);
if (data != null) {
diff --git a/wifi/java/android/net/wifi/p2p/nsd/WifiP2pUpnpServiceRequest.java b/wifi/java/android/net/wifi/p2p/nsd/WifiP2pUpnpServiceRequest.java
index b5cf144..98e447e 100644
--- a/wifi/java/android/net/wifi/p2p/nsd/WifiP2pUpnpServiceRequest.java
+++ b/wifi/java/android/net/wifi/p2p/nsd/WifiP2pUpnpServiceRequest.java
@@ -18,6 +18,8 @@
import android.net.wifi.p2p.WifiP2pManager;
+import java.util.Locale;
+
/**
* A class for creating a Upnp service discovery request for use with
* {@link WifiP2pManager#addServiceRequest} and {@link WifiP2pManager#removeServiceRequest}
@@ -73,7 +75,7 @@
throw new IllegalArgumentException("search target cannot be null");
}
StringBuffer sb = new StringBuffer();
- sb.append(String.format("%02x", WifiP2pUpnpServiceInfo.VERSION_1_0));
+ sb.append(String.format(Locale.US, "%02x", WifiP2pUpnpServiceInfo.VERSION_1_0));
sb.append(WifiP2pServiceInfo.bin2HexStr(st.getBytes()));
return new WifiP2pUpnpServiceRequest(sb.toString());
}