diff options
-rw-r--r-- | cmds/surfaceflinger/Android.mk | 2 | ||||
-rw-r--r-- | cmds/system_server/library/Android.mk | 6 | ||||
-rw-r--r-- | core/java/android/app/ApplicationErrorReport.java | 2 | ||||
-rwxr-xr-x | core/java/android/content/res/Resources.java | 8 | ||||
-rw-r--r-- | core/java/android/net/Proxy.java | 7 | ||||
-rw-r--r-- | core/java/android/os/Debug.java | 17 | ||||
-rw-r--r-- | core/java/android/provider/Telephony.java | 4 | ||||
-rw-r--r-- | core/java/android/webkit/WebView.java | 2 | ||||
-rw-r--r-- | core/java/com/android/internal/os/BatteryStatsImpl.java | 10 | ||||
-rw-r--r-- | core/java/com/android/internal/os/SamplingProfilerIntegration.java | 3 | ||||
-rw-r--r-- | core/tests/hosttests/Android.mk | 2 | ||||
-rw-r--r-- | core/tests/hosttests/src/android/content/pm/PackageManagerHostTestUtils.java | 283 | ||||
-rw-r--r-- | core/tests/hosttests/src/android/content/pm/PackageManagerHostTests.java | 388 | ||||
-rw-r--r-- | core/tests/hosttests/src/android/content/pm/PackageManagerStressHostTests.java | 21 | ||||
-rw-r--r-- | docs/html/guide/topics/resources/animation-resource.jd | 30 | ||||
-rw-r--r-- | media/mediaserver/Android.mk | 4 | ||||
-rw-r--r-- | services/audioflinger/A2dpAudioInterface.cpp (renamed from libs/audioflinger/A2dpAudioInterface.cpp) | 0 | ||||
-rw-r--r-- | services/audioflinger/A2dpAudioInterface.h (renamed from libs/audioflinger/A2dpAudioInterface.h) | 0 | ||||
-rw-r--r-- | services/audioflinger/Android.mk (renamed from libs/audioflinger/Android.mk) | 0 | ||||
-rw-r--r-- | services/audioflinger/AudioBufferProvider.h (renamed from libs/audioflinger/AudioBufferProvider.h) | 0 | ||||
-rw-r--r-- | services/audioflinger/AudioDumpInterface.cpp (renamed from libs/audioflinger/AudioDumpInterface.cpp) | 0 | ||||
-rw-r--r-- | services/audioflinger/AudioDumpInterface.h (renamed from libs/audioflinger/AudioDumpInterface.h) | 0 | ||||
-rw-r--r-- | services/audioflinger/AudioFlinger.cpp (renamed from libs/audioflinger/AudioFlinger.cpp) | 0 | ||||
-rw-r--r-- | services/audioflinger/AudioFlinger.h (renamed from libs/audioflinger/AudioFlinger.h) | 0 | ||||
-rw-r--r-- | services/audioflinger/AudioHardwareGeneric.cpp (renamed from libs/audioflinger/AudioHardwareGeneric.cpp) | 0 | ||||
-rw-r--r-- | services/audioflinger/AudioHardwareGeneric.h (renamed from libs/audioflinger/AudioHardwareGeneric.h) | 0 | ||||
-rw-r--r-- | services/audioflinger/AudioHardwareInterface.cpp (renamed from libs/audioflinger/AudioHardwareInterface.cpp) | 0 | ||||
-rw-r--r-- | services/audioflinger/AudioHardwareStub.cpp (renamed from libs/audioflinger/AudioHardwareStub.cpp) | 0 | ||||
-rw-r--r-- | services/audioflinger/AudioHardwareStub.h (renamed from libs/audioflinger/AudioHardwareStub.h) | 0 | ||||
-rw-r--r-- | services/audioflinger/AudioMixer.cpp (renamed from libs/audioflinger/AudioMixer.cpp) | 0 | ||||
-rw-r--r-- | services/audioflinger/AudioMixer.h (renamed from libs/audioflinger/AudioMixer.h) | 0 | ||||
-rw-r--r-- | services/audioflinger/AudioPolicyManagerBase.cpp (renamed from libs/audioflinger/AudioPolicyManagerBase.cpp) | 0 | ||||
-rw-r--r-- | services/audioflinger/AudioPolicyService.cpp (renamed from libs/audioflinger/AudioPolicyService.cpp) | 0 | ||||
-rw-r--r-- | services/audioflinger/AudioPolicyService.h (renamed from libs/audioflinger/AudioPolicyService.h) | 0 | ||||
-rw-r--r-- | services/audioflinger/AudioResampler.cpp (renamed from libs/audioflinger/AudioResampler.cpp) | 0 | ||||
-rw-r--r-- | services/audioflinger/AudioResampler.h (renamed from libs/audioflinger/AudioResampler.h) | 0 | ||||
-rw-r--r-- | services/audioflinger/AudioResamplerCubic.cpp (renamed from libs/audioflinger/AudioResamplerCubic.cpp) | 0 | ||||
-rw-r--r-- | services/audioflinger/AudioResamplerCubic.h (renamed from libs/audioflinger/AudioResamplerCubic.h) | 0 | ||||
-rw-r--r-- | services/audioflinger/AudioResamplerSinc.cpp (renamed from libs/audioflinger/AudioResamplerSinc.cpp) | 0 | ||||
-rw-r--r-- | services/audioflinger/AudioResamplerSinc.h (renamed from libs/audioflinger/AudioResamplerSinc.h) | 0 | ||||
-rw-r--r-- | services/camera/libcameraservice/Android.mk (renamed from camera/libcameraservice/Android.mk) | 0 | ||||
-rw-r--r-- | services/camera/libcameraservice/CameraHardwareStub.cpp (renamed from camera/libcameraservice/CameraHardwareStub.cpp) | 0 | ||||
-rw-r--r-- | services/camera/libcameraservice/CameraHardwareStub.h (renamed from camera/libcameraservice/CameraHardwareStub.h) | 0 | ||||
-rw-r--r-- | services/camera/libcameraservice/CameraService.cpp (renamed from camera/libcameraservice/CameraService.cpp) | 0 | ||||
-rw-r--r-- | services/camera/libcameraservice/CameraService.h (renamed from camera/libcameraservice/CameraService.h) | 0 | ||||
-rw-r--r-- | services/camera/libcameraservice/CannedJpeg.h (renamed from camera/libcameraservice/CannedJpeg.h) | 0 | ||||
-rw-r--r-- | services/camera/libcameraservice/FakeCamera.cpp (renamed from camera/libcameraservice/FakeCamera.cpp) | 0 | ||||
-rw-r--r-- | services/camera/libcameraservice/FakeCamera.h (renamed from camera/libcameraservice/FakeCamera.h) | 0 | ||||
-rw-r--r-- | services/camera/tests/CameraServiceTest/Android.mk (renamed from camera/tests/CameraServiceTest/Android.mk) | 0 | ||||
-rw-r--r-- | services/camera/tests/CameraServiceTest/CameraServiceTest.cpp (renamed from camera/tests/CameraServiceTest/CameraServiceTest.cpp) | 0 | ||||
-rw-r--r-- | services/java/com/android/server/WindowManagerService.java | 7 | ||||
-rw-r--r-- | services/java/com/android/server/am/ActivityManagerService.java | 13 | ||||
-rw-r--r-- | services/java/com/android/server/am/AppWaitingForDebuggerDialog.java | 3 | ||||
-rw-r--r-- | services/java/com/android/server/am/FactoryErrorDialog.java | 4 | ||||
-rw-r--r-- | services/surfaceflinger/Android.mk (renamed from libs/surfaceflinger/Android.mk) | 0 | ||||
-rw-r--r-- | services/surfaceflinger/Barrier.h (renamed from libs/surfaceflinger/Barrier.h) | 0 | ||||
-rw-r--r-- | services/surfaceflinger/BlurFilter.cpp (renamed from libs/surfaceflinger/BlurFilter.cpp) | 0 | ||||
-rw-r--r-- | services/surfaceflinger/BlurFilter.h (renamed from libs/surfaceflinger/BlurFilter.h) | 0 | ||||
-rw-r--r-- | services/surfaceflinger/DisplayHardware/DisplayHardware.cpp (renamed from libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp) | 0 | ||||
-rw-r--r-- | services/surfaceflinger/DisplayHardware/DisplayHardware.h (renamed from libs/surfaceflinger/DisplayHardware/DisplayHardware.h) | 0 | ||||
-rw-r--r-- | services/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp (renamed from libs/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp) | 0 | ||||
-rw-r--r-- | services/surfaceflinger/DisplayHardware/DisplayHardwareBase.h (renamed from libs/surfaceflinger/DisplayHardware/DisplayHardwareBase.h) | 0 | ||||
-rw-r--r-- | services/surfaceflinger/Layer.cpp (renamed from libs/surfaceflinger/Layer.cpp) | 0 | ||||
-rw-r--r-- | services/surfaceflinger/Layer.h (renamed from libs/surfaceflinger/Layer.h) | 0 | ||||
-rw-r--r-- | services/surfaceflinger/LayerBase.cpp (renamed from libs/surfaceflinger/LayerBase.cpp) | 0 | ||||
-rw-r--r-- | services/surfaceflinger/LayerBase.h (renamed from libs/surfaceflinger/LayerBase.h) | 0 | ||||
-rw-r--r-- | services/surfaceflinger/LayerBlur.cpp (renamed from libs/surfaceflinger/LayerBlur.cpp) | 0 | ||||
-rw-r--r-- | services/surfaceflinger/LayerBlur.h (renamed from libs/surfaceflinger/LayerBlur.h) | 0 | ||||
-rw-r--r-- | services/surfaceflinger/LayerBuffer.cpp (renamed from libs/surfaceflinger/LayerBuffer.cpp) | 0 | ||||
-rw-r--r-- | services/surfaceflinger/LayerBuffer.h (renamed from libs/surfaceflinger/LayerBuffer.h) | 0 | ||||
-rw-r--r-- | services/surfaceflinger/LayerDim.cpp (renamed from libs/surfaceflinger/LayerDim.cpp) | 0 | ||||
-rw-r--r-- | services/surfaceflinger/LayerDim.h (renamed from libs/surfaceflinger/LayerDim.h) | 0 | ||||
-rw-r--r-- | services/surfaceflinger/MODULE_LICENSE_APACHE2 (renamed from libs/surfaceflinger/MODULE_LICENSE_APACHE2) | 0 | ||||
-rw-r--r-- | services/surfaceflinger/MessageQueue.cpp (renamed from libs/surfaceflinger/MessageQueue.cpp) | 0 | ||||
-rw-r--r-- | services/surfaceflinger/MessageQueue.h (renamed from libs/surfaceflinger/MessageQueue.h) | 0 | ||||
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp (renamed from libs/surfaceflinger/SurfaceFlinger.cpp) | 0 | ||||
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.h (renamed from libs/surfaceflinger/SurfaceFlinger.h) | 0 | ||||
-rw-r--r-- | services/surfaceflinger/Tokenizer.cpp (renamed from libs/surfaceflinger/Tokenizer.cpp) | 0 | ||||
-rw-r--r-- | services/surfaceflinger/Tokenizer.h (renamed from libs/surfaceflinger/Tokenizer.h) | 0 | ||||
-rw-r--r-- | services/surfaceflinger/Transform.cpp (renamed from libs/surfaceflinger/Transform.cpp) | 0 | ||||
-rw-r--r-- | services/surfaceflinger/Transform.h (renamed from libs/surfaceflinger/Transform.h) | 0 | ||||
-rw-r--r-- | services/surfaceflinger/clz.cpp (renamed from libs/surfaceflinger/clz.cpp) | 0 | ||||
-rw-r--r-- | services/surfaceflinger/clz.h (renamed from libs/surfaceflinger/clz.h) | 0 | ||||
-rw-r--r-- | services/surfaceflinger/tests/Android.mk (renamed from libs/surfaceflinger/tests/Android.mk) | 0 | ||||
-rw-r--r-- | services/surfaceflinger/tests/overlays/Android.mk (renamed from libs/surfaceflinger/tests/overlays/Android.mk) | 0 | ||||
-rw-r--r-- | services/surfaceflinger/tests/overlays/overlays.cpp (renamed from libs/surfaceflinger/tests/overlays/overlays.cpp) | 0 | ||||
-rw-r--r-- | services/surfaceflinger/tests/resize/Android.mk (renamed from libs/surfaceflinger/tests/resize/Android.mk) | 0 | ||||
-rw-r--r-- | services/surfaceflinger/tests/resize/resize.cpp (renamed from libs/surfaceflinger/tests/resize/resize.cpp) | 0 | ||||
-rw-r--r-- | telephony/java/com/android/internal/telephony/AdnRecordCache.java | 19 | ||||
-rw-r--r-- | telephony/java/com/android/internal/telephony/IccCard.java | 9 | ||||
-rw-r--r-- | telephony/java/com/android/internal/telephony/IccPhoneBookInterfaceManager.java | 3 | ||||
-rw-r--r-- | telephony/java/com/android/internal/telephony/RIL.java | 5 | ||||
-rw-r--r-- | telephony/java/com/android/internal/telephony/gsm/SIMRecords.java | 7 | ||||
-rwxr-xr-x[-rw-r--r--] | telephony/java/com/android/internal/telephony/gsm/UsimPhoneBookManager.java | 25 |
94 files changed, 661 insertions, 223 deletions
diff --git a/cmds/surfaceflinger/Android.mk b/cmds/surfaceflinger/Android.mk index bfa58a1..1df32bb 100644 --- a/cmds/surfaceflinger/Android.mk +++ b/cmds/surfaceflinger/Android.mk @@ -10,7 +10,7 @@ LOCAL_SHARED_LIBRARIES := \ libutils LOCAL_C_INCLUDES := \ - $(LOCAL_PATH)/../../libs/surfaceflinger + $(LOCAL_PATH)/../../services/surfaceflinger LOCAL_MODULE:= surfaceflinger diff --git a/cmds/system_server/library/Android.mk b/cmds/system_server/library/Android.mk index 1813d3e..a880a91 100644 --- a/cmds/system_server/library/Android.mk +++ b/cmds/system_server/library/Android.mk @@ -7,9 +7,9 @@ LOCAL_SRC_FILES:= \ base = $(LOCAL_PATH)/../../.. LOCAL_C_INCLUDES := \ - $(base)/camera/libcameraservice \ - $(base)/libs/audioflinger \ - $(base)/libs/surfaceflinger \ + $(base)/services/camera/libcameraservice \ + $(base)/services/audioflinger \ + $(base)/services/surfaceflinger \ $(base)/media/libmediaplayerservice \ $(JNI_H_INCLUDE) diff --git a/core/java/android/app/ApplicationErrorReport.java b/core/java/android/app/ApplicationErrorReport.java index f0cef98..ec39ac7 100644 --- a/core/java/android/app/ApplicationErrorReport.java +++ b/core/java/android/app/ApplicationErrorReport.java @@ -174,7 +174,7 @@ public class ApplicationErrorReport implements Parcelable { /** * Return activity in receiverPackage that handles ACTION_APP_ERROR. * - * @param pm PackageManager isntance + * @param pm PackageManager instance * @param errorPackage package which caused the error * @param receiverPackage candidate package to receive the error * @return activity component within receiverPackage which handles diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java index 3387fc9..e671359 100755 --- a/core/java/android/content/res/Resources.java +++ b/core/java/android/content/res/Resources.java @@ -1305,8 +1305,8 @@ public class Resources { keyboardHidden, mConfiguration.navigation, width, height, mConfiguration.screenLayout, mConfiguration.uiMode, sSdkVersion); - drawableCacheClear(mDrawableCache, configChanges); - drawableCacheClear(mColorDrawableCache, configChanges); + clearDrawableCache(mDrawableCache, configChanges); + clearDrawableCache(mColorDrawableCache, configChanges); mColorStateListCache.clear(); @@ -1320,7 +1320,7 @@ public class Resources { } } - private void drawableCacheClear( + private void clearDrawableCache( LongSparseArray<WeakReference<ConstantState>> cache, int configChanges) { int N = cache.size(); @@ -1781,7 +1781,7 @@ public class Resources { //Log.i(TAG, "Returning cached drawable @ #" + // Integer.toHexString(((Integer)key).intValue()) // + " in " + this + ": " + entry); - return entry.newDrawable(); + return entry.newDrawable(this); } else { // our entry has been purged drawableCache.delete(key); diff --git a/core/java/android/net/Proxy.java b/core/java/android/net/Proxy.java index 39d4ac1..22c30a5 100644 --- a/core/java/android/net/Proxy.java +++ b/core/java/android/net/Proxy.java @@ -16,8 +16,6 @@ package android.net; -import org.apache.harmony.luni.platform.INetworkSystem; -import org.apache.harmony.luni.platform.Platform; import org.apache.http.HttpHost; import android.content.ContentResolver; @@ -44,8 +42,6 @@ final public class Proxy { static final public String PROXY_CHANGE_ACTION = "android.intent.action.PROXY_CHANGE"; - static final private INetworkSystem NETIMPL = Platform.getNetworkSystem(); - /** * Return the proxy host set by the user. * @param ctx A Context used to get the settings for the proxy host. @@ -169,8 +165,7 @@ final public class Proxy { if (host.equalsIgnoreCase("localhost")) { return true; } - if (InetAddress.getByAddress(NETIMPL.ipStringToByteArray(host)) - .isLoopbackAddress()) { + if (InetAddress.getByName(host).isLoopbackAddress()) { return true; } } diff --git a/core/java/android/os/Debug.java b/core/java/android/os/Debug.java index 2e14667..86f9a6b 100644 --- a/core/java/android/os/Debug.java +++ b/core/java/android/os/Debug.java @@ -94,7 +94,8 @@ public final class Debug /** * Default trace file path and file */ - private static final String DEFAULT_TRACE_PATH_PREFIX = "/sdcard/"; + private static final String DEFAULT_TRACE_PATH_PREFIX = + Environment.getExternalStorageDirectory().getPath() + "/"; private static final String DEFAULT_TRACE_BODY = "dmtrace"; private static final String DEFAULT_TRACE_EXTENSION = ".trace"; private static final String DEFAULT_TRACE_FILE_PATH = @@ -127,7 +128,7 @@ public final class Debug public int otherPrivateDirty; /** The shared dirty pages used by everything else. */ public int otherSharedDirty; - + public MemoryInfo() { } @@ -137,21 +138,21 @@ public final class Debug public int getTotalPss() { return dalvikPss + nativePss + otherPss; } - + /** * Return total private dirty memory usage in kB. */ public int getTotalPrivateDirty() { return dalvikPrivateDirty + nativePrivateDirty + otherPrivateDirty; } - + /** * Return total shared dirty memory usage in kB. */ public int getTotalSharedDirty() { return dalvikSharedDirty + nativeSharedDirty + otherSharedDirty; } - + public int describeContents() { return 0; } @@ -179,7 +180,7 @@ public final class Debug otherPrivateDirty = source.readInt(); otherSharedDirty = source.readInt(); } - + public static final Creator<MemoryInfo> CREATOR = new Creator<MemoryInfo>() { public MemoryInfo createFromParcel(Parcel source) { return new MemoryInfo(source); @@ -460,7 +461,7 @@ href="{@docRoot}guide/developing/tools/traceview.html">Traceview: A Graphical Lo * Like startMethodTracing(String, int, int), but taking an already-opened * FileDescriptor in which the trace is written. The file name is also * supplied simply for logging. Makes a dup of the file descriptor. - * + * * Not exposed in the SDK unless we are really comfortable with supporting * this and find it would be useful. * @hide @@ -1070,7 +1071,7 @@ href="{@docRoot}guide/developing/tools/traceview.html">Traceview: A Graphical Lo * static { * // Sets all the fields * Debug.setFieldsOn(MyDebugVars.class); - * + * * // Sets only the fields annotated with @Debug.DebugProperty * // Debug.setFieldsOn(MyDebugVars.class, true); * } diff --git a/core/java/android/provider/Telephony.java b/core/java/android/provider/Telephony.java index bf9e854..d271e93 100644 --- a/core/java/android/provider/Telephony.java +++ b/core/java/android/provider/Telephony.java @@ -25,6 +25,7 @@ import android.content.Intent; import android.database.Cursor; import android.database.sqlite.SqliteWrapper; import android.net.Uri; +import android.os.Environment; import android.telephony.SmsMessage; import android.text.TextUtils; import android.util.Config; @@ -1526,7 +1527,8 @@ public final class Telephony { * which streams the captured image to the uri. Internally we write the media content * to this file. It's named '.temp.jpg' so Gallery won't pick it up. */ - public static final String SCRAP_FILE_PATH = "/sdcard/mms/scrapSpace/.temp.jpg"; + public static final String SCRAP_FILE_PATH = + Environment.getExternalStorageDirectory().getPath() + "/mms/scrapSpace/.temp.jpg"; } public static final class Intents { diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 740c010..8e363d6 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -238,7 +238,7 @@ import junit.framework.Assert; * * <p>The screen density of a device is based on the screen resolution. A screen with low density * has fewer available pixels per inch, where a screen with high density - * has more — sometimes significantly more — pixels per inch. The density of a + * has more - sometimes significantly more - pixels per inch. The density of a * screen is important because, other things being equal, a UI element (such as a button) whose * height and width are defined in terms of screen pixels will appear larger on the lower density * screen and smaller on the higher density screen. diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java index aadb576..167e45d 100644 --- a/core/java/com/android/internal/os/BatteryStatsImpl.java +++ b/core/java/com/android/internal/os/BatteryStatsImpl.java @@ -844,7 +844,7 @@ public final class BatteryStatsImpl extends BatteryStats { private final Map<String, KernelWakelockStats> readKernelWakelockStats() { - byte[] buffer = new byte[4096]; + byte[] buffer = new byte[8192]; int len; try { @@ -891,9 +891,11 @@ public final class BatteryStatsImpl extends BatteryStats { for (endIndex=startIndex; endIndex < len && wlBuffer[endIndex] != '\n' && wlBuffer[endIndex] != '\0'; endIndex++); - // Don't go over the end of the buffer - if (endIndex < len) { - endIndex++; // endIndex is an exclusive upper bound. + endIndex++; // endIndex is an exclusive upper bound. + // Don't go over the end of the buffer, Process.parseProcLine might + // write to wlBuffer[endIndex] + if (endIndex >= (len - 1) ) { + return m; } String[] nameStringArray = mProcWakelocksName; diff --git a/core/java/com/android/internal/os/SamplingProfilerIntegration.java b/core/java/com/android/internal/os/SamplingProfilerIntegration.java index 5f5c7a4..127fb23 100644 --- a/core/java/com/android/internal/os/SamplingProfilerIntegration.java +++ b/core/java/com/android/internal/os/SamplingProfilerIntegration.java @@ -85,7 +85,8 @@ public class SamplingProfilerIntegration { pending = true; snapshotWriter.execute(new Runnable() { public void run() { - String dir = "/sdcard/snapshots"; + String dir = + Environment.getExternalStorageDirectory().getPath() + "/snapshots"; if (!dirMade) { new File(dir).mkdirs(); if (new File(dir).isDirectory()) { diff --git a/core/tests/hosttests/Android.mk b/core/tests/hosttests/Android.mk index 0001201..07d99cb 100644 --- a/core/tests/hosttests/Android.mk +++ b/core/tests/hosttests/Android.mk @@ -23,7 +23,7 @@ LOCAL_SRC_FILES := $(call all-java-files-under, src) LOCAL_MODULE := FrameworkCoreHostTests -LOCAL_JAVA_LIBRARIES := hosttestlib ddmlib junit +LOCAL_JAVA_LIBRARIES := hosttestlib ddmlib-prebuilt junit include $(BUILD_HOST_JAVA_LIBRARY) diff --git a/core/tests/hosttests/src/android/content/pm/PackageManagerHostTestUtils.java b/core/tests/hosttests/src/android/content/pm/PackageManagerHostTestUtils.java index 91cbe2f..b225c37 100644 --- a/core/tests/hosttests/src/android/content/pm/PackageManagerHostTestUtils.java +++ b/core/tests/hosttests/src/android/content/pm/PackageManagerHostTestUtils.java @@ -16,32 +16,32 @@ package android.content.pm; +import com.android.ddmlib.AdbCommandRejectedException; import com.android.ddmlib.AndroidDebugBridge; import com.android.ddmlib.IDevice; import com.android.ddmlib.IShellOutputReceiver; +import com.android.ddmlib.InstallException; import com.android.ddmlib.Log; import com.android.ddmlib.MultiLineReceiver; -import com.android.ddmlib.SyncService; +import com.android.ddmlib.ShellCommandUnresponsiveException; +import com.android.ddmlib.SyncException; +import com.android.ddmlib.TimeoutException; import com.android.ddmlib.SyncService.ISyncProgressMonitor; -import com.android.ddmlib.SyncService.SyncResult; import com.android.ddmlib.testrunner.ITestRunListener; import com.android.ddmlib.testrunner.RemoteAndroidTestRunner; import com.android.ddmlib.testrunner.TestIdentifier; -import com.android.hosttest.DeviceTestCase; -import com.android.hosttest.DeviceTestSuite; import java.io.BufferedReader; -import java.io.File; -import java.io.InputStreamReader; import java.io.IOException; +import java.io.InputStreamReader; import java.io.StringReader; import java.lang.Runtime; import java.lang.Process; +import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; import junit.framework.Assert; -import com.android.hosttest.DeviceTestCase; /** * Set of tests that verify host side install cases @@ -119,8 +119,14 @@ public class PackageManagerHostTestUtils extends Assert { * Helper method to run tests and return the listener that collected the results. * @param pkgName Android application package for tests * @return the {@link CollectingTestRunListener} - */ - private CollectingTestRunListener doRunTests(String pkgName) throws IOException { + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + */ + private CollectingTestRunListener doRunTests(String pkgName) throws IOException, + TimeoutException, AdbCommandRejectedException, ShellCommandUnresponsiveException { RemoteAndroidTestRunner testRunner = new RemoteAndroidTestRunner( pkgName, mDevice); CollectingTestRunListener listener = new CollectingTestRunListener(); @@ -133,8 +139,14 @@ public class PackageManagerHostTestUtils extends Assert { * * @param pkgName Android application package for tests * @return true if every test passed, false otherwise. - */ - public boolean runDeviceTestsDidAllTestsPass(String pkgName) throws IOException { + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + */ + public boolean runDeviceTestsDidAllTestsPass(String pkgName) throws IOException, + TimeoutException, AdbCommandRejectedException, ShellCommandUnresponsiveException { CollectingTestRunListener listener = doRunTests(pkgName); return listener.didAllTestsPass(); } @@ -142,22 +154,26 @@ public class PackageManagerHostTestUtils extends Assert { /** * Helper method to push a file to device * @param apkAppPrivatePath - * @throws IOException + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws IOException if connection to device was lost. + * @throws SyncException if the sync failed for another reason. */ public void pushFile(final String localFilePath, final String destFilePath) - throws IOException { - SyncResult result = mDevice.getSyncService().pushFile( - localFilePath, destFilePath, new NullSyncProgressMonitor()); - assertEquals(SyncService.RESULT_OK, result.getCode()); + throws IOException, SyncException, TimeoutException, AdbCommandRejectedException { + mDevice.getSyncService().pushFile(localFilePath, + destFilePath, new NullSyncProgressMonitor()); } /** * Helper method to install a file * @param localFilePath the absolute file system path to file on local host to install * @param reinstall set to <code>true</code> if re-install of app should be performed - * @throws IOException + * @throws IOException if connection to device was lost. + * @throws InstallException if the install failed */ - public void installFile(final String localFilePath, final boolean replace) throws IOException { + public void installFile(final String localFilePath, final boolean replace) throws IOException, + InstallException { String result = mDevice.installPackage(localFilePath, replace); assertEquals(null, result); } @@ -167,10 +183,11 @@ public class PackageManagerHostTestUtils extends Assert { * @param localFilePath the absolute file system path to file on local host to install * @param reinstall set to <code>true</code> if re-install of app should be performed * @return the string output of the failed install attempt - * @throws IOException + * @throws IOException if connection to device was lost. + * @throws InstallException if the install failed */ public String installFileFail(final String localFilePath, final boolean replace) - throws IOException { + throws IOException, InstallException { String result = mDevice.installPackage(localFilePath, replace); assertNotNull(result); return result; @@ -180,10 +197,17 @@ public class PackageManagerHostTestUtils extends Assert { * Helper method to install a file to device as forward locked * @param localFilePath the absolute file system path to file on local host to install * @param reinstall set to <code>true</code> if re-install of app should be performed - * @throws IOException + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws SyncException if the sync failed for another reason. + * @throws InstallException if the install failed. */ public String installFileForwardLocked(final String localFilePath, final boolean replace) - throws IOException { + throws IOException, SyncException, TimeoutException, AdbCommandRejectedException, + ShellCommandUnresponsiveException, InstallException { String remoteFilePath = mDevice.syncPackageToDevice(localFilePath); InstallReceiver receiver = new InstallReceiver(); String cmd = String.format(replace ? "pm install -r -l \"%1$s\"" : @@ -198,9 +222,14 @@ public class PackageManagerHostTestUtils extends Assert { * * @param destPath the absolute path of file on device to check * @return <code>true</code> if file exists, <code>false</code> otherwise. - * @throws IOException if adb shell command failed - */ - public boolean doesRemoteFileExist(String destPath) throws IOException { + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + */ + public boolean doesRemoteFileExist(String destPath) throws IOException, TimeoutException, + AdbCommandRejectedException, ShellCommandUnresponsiveException { String lsGrep = executeShellCommand(String.format("ls %s", destPath)); return !lsGrep.contains("No such file or directory"); } @@ -211,10 +240,15 @@ public class PackageManagerHostTestUtils extends Assert { * @param destPath the absolute path of the file * @return <code>true</code> if file exists containing given string, * <code>false</code> otherwise. - * @throws IOException if adb shell command failed + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. */ public boolean doesRemoteFileExistContainingString(String destPath, String searchString) - throws IOException { + throws IOException, TimeoutException, AdbCommandRejectedException, + ShellCommandUnresponsiveException { String lsResult = executeShellCommand(String.format("ls %s", destPath)); return lsResult.contains(searchString); } @@ -224,9 +258,14 @@ public class PackageManagerHostTestUtils extends Assert { * * @param packageName the Android manifest package to check. * @return <code>true</code> if package exists, <code>false</code> otherwise - * @throws IOException if adb shell command failed - */ - public boolean doesPackageExist(String packageName) throws IOException { + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + */ + public boolean doesPackageExist(String packageName) throws IOException, TimeoutException, + AdbCommandRejectedException, ShellCommandUnresponsiveException { String pkgGrep = executeShellCommand(String.format("pm path %s", packageName)); return pkgGrep.contains("package:"); } @@ -236,9 +275,14 @@ public class PackageManagerHostTestUtils extends Assert { * * @param packageName package name to check for * @return <code>true</code> if file exists, <code>false</code> otherwise. - * @throws IOException if adb shell command failed - */ - public boolean doesAppExistOnDevice(String packageName) throws IOException { + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + */ + public boolean doesAppExistOnDevice(String packageName) throws IOException, TimeoutException, + AdbCommandRejectedException, ShellCommandUnresponsiveException { return doesRemoteFileExistContainingString(DEVICE_APP_PATH, packageName); } @@ -247,9 +291,14 @@ public class PackageManagerHostTestUtils extends Assert { * * @param packageName package name to check for * @return <code>true</code> if file exists, <code>false</code> otherwise. - * @throws IOException if adb shell command failed - */ - public boolean doesAppExistOnSDCard(String packageName) throws IOException { + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + */ + public boolean doesAppExistOnSDCard(String packageName) throws IOException, TimeoutException, + AdbCommandRejectedException, ShellCommandUnresponsiveException { return doesRemoteFileExistContainingString(SDCARD_APP_PATH, packageName); } @@ -258,9 +307,14 @@ public class PackageManagerHostTestUtils extends Assert { * * @param packageName package name to check for * @return <code>true</code> if file exists, <code>false</code> otherwise. - * @throws IOException if adb shell command failed - */ - public boolean doesAppExistAsForwardLocked(String packageName) throws IOException { + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + */ + public boolean doesAppExistAsForwardLocked(String packageName) throws IOException, + TimeoutException, AdbCommandRejectedException, ShellCommandUnresponsiveException { return doesRemoteFileExistContainingString(APP_PRIVATE_PATH, packageName); } @@ -268,9 +322,14 @@ public class PackageManagerHostTestUtils extends Assert { * Waits for device's package manager to respond. * * @throws InterruptedException - * @throws IOException - */ - public void waitForPackageManager() throws InterruptedException, IOException { + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + */ + public void waitForPackageManager() throws InterruptedException, IOException, TimeoutException, + AdbCommandRejectedException, ShellCommandUnresponsiveException { Log.i(LOG_TAG, "waiting for device"); int currentWaitTime = 0; // poll the package manager until it returns something for android @@ -336,9 +395,14 @@ public class PackageManagerHostTestUtils extends Assert { * * @param packageName The name of the package to wait to load * @throws InterruptedException - * @throws IOException - */ - public void waitForApp(String packageName) throws InterruptedException, IOException { + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + */ + public void waitForApp(String packageName) throws InterruptedException, IOException, + TimeoutException, AdbCommandRejectedException, ShellCommandUnresponsiveException { Log.i(LOG_TAG, "waiting for app to launch"); int currentWaitTime = 0; // poll the package manager until it returns something for the package we're looking for @@ -355,9 +419,14 @@ public class PackageManagerHostTestUtils extends Assert { /** * Helper method which executes a adb shell command and returns output as a {@link String} * @return the output of the command - * @throws IOException - */ - public String executeShellCommand(String command) throws IOException { + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + */ + public String executeShellCommand(String command) throws IOException, TimeoutException, + AdbCommandRejectedException, ShellCommandUnresponsiveException { Log.i(LOG_TAG, String.format("adb shell %s", command)); CollectingOutputReceiver receiver = new CollectingOutputReceiver(); mDevice.executeShellCommand(command, receiver); @@ -369,9 +438,14 @@ public class PackageManagerHostTestUtils extends Assert { /** * Helper method ensures we are in root mode on the host side. It returns only after * PackageManager is actually up and running. - * @throws IOException - */ - public void runAdbRoot() throws IOException, InterruptedException { + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + */ + public void runAdbRoot() throws IOException, InterruptedException, TimeoutException, + AdbCommandRejectedException, ShellCommandUnresponsiveException { Log.i(LOG_TAG, "adb root"); Runtime runtime = Runtime.getRuntime(); Process process = runtime.exec("adb root"); // adb should be in the path @@ -389,10 +463,15 @@ public class PackageManagerHostTestUtils extends Assert { /** * Helper method which reboots the device and returns once the device is online again * and package manager is up and running (note this function is synchronous to callers). - * @throws IOException * @throws InterruptedException - */ - public void rebootDevice() throws IOException, InterruptedException { + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + */ + public void rebootDevice() throws IOException, InterruptedException, TimeoutException, + AdbCommandRejectedException, ShellCommandUnresponsiveException { String command = "reboot"; // no need for -s since mDevice is already tied to a device Log.i(LOG_TAG, command); CollectingOutputReceiver receiver = new CollectingOutputReceiver(); @@ -468,7 +547,7 @@ public class PackageManagerHostTestUtils extends Assert { mAllTestsPassed = false; } - public void testRunEnded(long elapsedTime) { + public void testRunEnded(long elapsedTime, Map<String, String> resultBundle) { // ignore } @@ -545,17 +624,23 @@ public class PackageManagerHostTestUtils extends Assert { /** * Helper method for installing an app to wherever is specified in its manifest, and * then verifying the app was installed onto SD Card. + * <p/> + * Assumes adb is running as root in device under test. * * @param the path of the apk to install * @param the name of the package * @param <code>true</code> if the app should be overwritten, <code>false</code> otherwise - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted - * <p/> - * Assumes adb is running as root in device under test. + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws InstallException if the install failed. */ public void installAppAndVerifyExistsOnSDCard(String apkPath, String pkgName, boolean overwrite) - throws IOException, InterruptedException { + throws IOException, InterruptedException, InstallException, TimeoutException, + AdbCommandRejectedException, ShellCommandUnresponsiveException { // Start with a clean slate if we're not overwriting if (!overwrite) { // cleanup test app just in case it already exists @@ -576,17 +661,23 @@ public class PackageManagerHostTestUtils extends Assert { /** * Helper method for installing an app to wherever is specified in its manifest, and * then verifying the app was installed onto device. + * <p/> + * Assumes adb is running as root in device under test. * * @param the path of the apk to install * @param the name of the package * @param <code>true</code> if the app should be overwritten, <code>false</code> otherwise - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted - * <p/> - * Assumes adb is running as root in device under test. + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws InstallException if the install failed. */ public void installAppAndVerifyExistsOnDevice(String apkPath, String pkgName, boolean overwrite) - throws IOException, InterruptedException { + throws IOException, InterruptedException, InstallException, TimeoutException, + AdbCommandRejectedException, ShellCommandUnresponsiveException { // Start with a clean slate if we're not overwriting if (!overwrite) { // cleanup test app just in case it already exists @@ -607,17 +698,24 @@ public class PackageManagerHostTestUtils extends Assert { /** * Helper method for installing an app as forward-locked, and * then verifying the app was installed in the proper forward-locked location. + * <p/> + * Assumes adb is running as root in device under test. * * @param the path of the apk to install * @param the name of the package * @param <code>true</code> if the app should be overwritten, <code>false</code> otherwise - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted - * <p/> - * Assumes adb is running as root in device under test. + * @throws IOException if connection to device was lost. + * @throws InstallException if the install failed. + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. */ public void installFwdLockedAppAndVerifyExists(String apkPath, - String pkgName, boolean overwrite) throws IOException, InterruptedException { + String pkgName, boolean overwrite) throws IOException, InterruptedException, + InstallException, SyncException, TimeoutException, AdbCommandRejectedException, + ShellCommandUnresponsiveException { // Start with a clean slate if we're not overwriting if (!overwrite) { // cleanup test app just in case it already exists @@ -638,14 +736,21 @@ public class PackageManagerHostTestUtils extends Assert { /** * Helper method for uninstalling an app. + * <p/> + * Assumes adb is running as root in device under test. * * @param pkgName package name to uninstall - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted - * <p/> - * Assumes adb is running as root in device under test. - */ - public void uninstallApp(String pkgName) throws IOException, InterruptedException { + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws InstallException if the uninstall failed. + */ + public void uninstallApp(String pkgName) throws IOException, InterruptedException, + InstallException, TimeoutException, AdbCommandRejectedException, + ShellCommandUnresponsiveException { mDevice.uninstallPackage(pkgName); // make sure its not installed anymore assertFalse(doesPackageExist(pkgName)); @@ -655,12 +760,18 @@ public class PackageManagerHostTestUtils extends Assert { * Helper method for clearing any installed non-system apps. * Useful ensuring no non-system apps are installed, and for cleaning up stale files that * may be lingering on the system for whatever reason. - * - * @throws IOException if adb shell command failed * <p/> * Assumes adb is running as root in device under test. - */ - public void wipeNonSystemApps() throws IOException { + * + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws InstallException if the uninstall failed. + */ + public void wipeNonSystemApps() throws IOException, TimeoutException, + AdbCommandRejectedException, ShellCommandUnresponsiveException, InstallException { String allInstalledPackages = executeShellCommand("pm list packages -f"); BufferedReader outputReader = new BufferedReader(new StringReader(allInstalledPackages)); @@ -685,8 +796,14 @@ public class PackageManagerHostTestUtils extends Assert { * * <p/> * Assumes adb is running as root in device under test. - */ - public void setDevicePreferredInstallLocation(InstallLocPreference pref) throws IOException { + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + */ + public void setDevicePreferredInstallLocation(InstallLocPreference pref) throws IOException, + TimeoutException, AdbCommandRejectedException, ShellCommandUnresponsiveException { String command = "pm setInstallLocation %d"; int locValue = 0; switch (pref) { @@ -708,8 +825,14 @@ public class PackageManagerHostTestUtils extends Assert { * * <p/> * Assumes adb is running as root in device under test. - */ - public InstallLocPreference getDevicePreferredInstallLocation() throws IOException { + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + */ + public InstallLocPreference getDevicePreferredInstallLocation() throws IOException, + TimeoutException, AdbCommandRejectedException, ShellCommandUnresponsiveException { String result = executeShellCommand("pm getInstallLocation"); if (result.indexOf('0') != -1) { return InstallLocPreference.AUTO; diff --git a/core/tests/hosttests/src/android/content/pm/PackageManagerHostTests.java b/core/tests/hosttests/src/android/content/pm/PackageManagerHostTests.java index 1b797d5..22a2be6 100644 --- a/core/tests/hosttests/src/android/content/pm/PackageManagerHostTests.java +++ b/core/tests/hosttests/src/android/content/pm/PackageManagerHostTests.java @@ -16,13 +16,12 @@ package android.content.pm; -import com.android.ddmlib.IDevice; -import com.android.ddmlib.IShellOutputReceiver; +import com.android.ddmlib.AdbCommandRejectedException; +import com.android.ddmlib.InstallException; import com.android.ddmlib.Log; -import com.android.ddmlib.MultiLineReceiver; -import com.android.ddmlib.SyncService; -import com.android.ddmlib.SyncService.ISyncProgressMonitor; -import com.android.ddmlib.SyncService.SyncResult; +import com.android.ddmlib.ShellCommandUnresponsiveException; +import com.android.ddmlib.SyncException; +import com.android.ddmlib.TimeoutException; import com.android.hosttest.DeviceTestCase; import com.android.hosttest.DeviceTestSuite; @@ -156,10 +155,18 @@ public class PackageManagerHostTests extends DeviceTestCase { * the app, and otherwise cause the system to blow up. * <p/> * Assumes adb is running as root in device under test. - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws SyncException if the sync failed for another reason. + * @throws InstallException if the install failed. */ - public void testPushAppPrivate() throws IOException, InterruptedException { + public void testPushAppPrivate() throws IOException, InterruptedException, InstallException, + TimeoutException, AdbCommandRejectedException, ShellCommandUnresponsiveException, + SyncException { Log.i(LOG_TAG, "testing pushing an apk to /data/app-private"); final String apkAppPrivatePath = appPrivatePath + SIMPLE_APK; @@ -187,12 +194,18 @@ public class PackageManagerHostTests extends DeviceTestCase { * @param apkName the file name of the test app apk * @param pkgName the package name of the test app apk * @param expectedLocation the file name of the test app apk - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws InstallException if the install failed. */ private void doStandardInstall(String apkName, String pkgName, PackageManagerHostTestUtils.InstallLocation expectedLocation) - throws IOException, InterruptedException { + throws IOException, InterruptedException, InstallException, TimeoutException, + AdbCommandRejectedException, ShellCommandUnresponsiveException { if (expectedLocation == PackageManagerHostTestUtils.InstallLocation.DEVICE) { mPMHostUtils.installAppAndVerifyExistsOnDevice( @@ -211,12 +224,18 @@ public class PackageManagerHostTests extends DeviceTestCase { * Assumes adb is running as root in device under test. * @param preference the device's preferred location of where to install apps * @param expectedLocation the expected location of where the apk was installed - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws InstallException if the install failed. */ public void installAppAutoLoc(PackageManagerHostTestUtils.InstallLocPreference preference, PackageManagerHostTestUtils.InstallLocation expectedLocation) - throws IOException, InterruptedException { + throws IOException, InterruptedException, TimeoutException, AdbCommandRejectedException, + ShellCommandUnresponsiveException, InstallException { PackageManagerHostTestUtils.InstallLocPreference savedPref = PackageManagerHostTestUtils.InstallLocPreference.AUTO; @@ -239,10 +258,16 @@ public class PackageManagerHostTests extends DeviceTestCase { * will install the app to the device when device's preference is auto. * <p/> * Assumes adb is running as root in device under test. - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws InstallException if the install failed. */ - public void testInstallAppAutoLocPrefIsAuto() throws IOException, InterruptedException { + public void testInstallAppAutoLocPrefIsAuto() throws IOException, InterruptedException, + InstallException, TimeoutException, AdbCommandRejectedException, ShellCommandUnresponsiveException { Log.i(LOG_TAG, "Test installLocation=auto, prefer=auto gets installed on device"); installAppAutoLoc(PackageManagerHostTestUtils.InstallLocPreference.AUTO, PackageManagerHostTestUtils.InstallLocation.DEVICE); @@ -253,10 +278,17 @@ public class PackageManagerHostTests extends DeviceTestCase { * will install the app to the device when device's preference is internal. * <p/> * Assumes adb is running as root in device under test. - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws InstallException if the install failed. */ - public void testInstallAppAutoLocPrefIsInternal() throws IOException, InterruptedException { + public void testInstallAppAutoLocPrefIsInternal() throws IOException, InterruptedException, + InstallException, TimeoutException, AdbCommandRejectedException, + ShellCommandUnresponsiveException { Log.i(LOG_TAG, "Test installLocation=auto, prefer=internal gets installed on device"); installAppAutoLoc(PackageManagerHostTestUtils.InstallLocPreference.INTERNAL, PackageManagerHostTestUtils.InstallLocation.DEVICE); @@ -267,10 +299,17 @@ public class PackageManagerHostTests extends DeviceTestCase { * will install the app to the SD card when device's preference is external. * <p/> * Assumes adb is running as root in device under test. - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws InstallException if the install failed. */ - public void testInstallAppAutoLocPrefIsExternal() throws IOException, InterruptedException { + public void testInstallAppAutoLocPrefIsExternal() throws IOException, InterruptedException, + InstallException, TimeoutException, AdbCommandRejectedException, + ShellCommandUnresponsiveException { Log.i(LOG_TAG, "Test installLocation=auto, prefer=external gets installed on device"); installAppAutoLoc(PackageManagerHostTestUtils.InstallLocPreference.EXTERNAL, PackageManagerHostTestUtils.InstallLocation.DEVICE); @@ -283,12 +322,18 @@ public class PackageManagerHostTests extends DeviceTestCase { * Assumes adb is running as root in device under test. * @param preference the device's preferred location of where to install apps * @param expectedLocation the expected location of where the apk was installed - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws InstallException if the (un)install failed. */ public void installAppInternalLoc(PackageManagerHostTestUtils.InstallLocPreference preference, PackageManagerHostTestUtils.InstallLocation expectedLocation) - throws IOException, InterruptedException { + throws IOException, InterruptedException, TimeoutException, AdbCommandRejectedException, + ShellCommandUnresponsiveException, InstallException { PackageManagerHostTestUtils.InstallLocPreference savedPref = PackageManagerHostTestUtils.InstallLocPreference.AUTO; @@ -311,10 +356,17 @@ public class PackageManagerHostTests extends DeviceTestCase { * will install the app to the device when device's preference is auto. * <p/> * Assumes adb is running as root in device under test. - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws InstallException if the install failed. */ - public void testInstallAppInternalLocPrefIsAuto() throws IOException, InterruptedException { + public void testInstallAppInternalLocPrefIsAuto() throws IOException, InterruptedException, + InstallException, TimeoutException, AdbCommandRejectedException, + ShellCommandUnresponsiveException { Log.i(LOG_TAG, "Test installLocation=internal, prefer=auto gets installed on device"); installAppInternalLoc(PackageManagerHostTestUtils.InstallLocPreference.AUTO, PackageManagerHostTestUtils.InstallLocation.DEVICE); @@ -325,10 +377,17 @@ public class PackageManagerHostTests extends DeviceTestCase { * will install the app to the device when device's preference is internal. * <p/> * Assumes adb is running as root in device under test. - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws InstallException if the install failed. */ - public void testInstallAppInternalLocPrefIsInternal() throws IOException, InterruptedException { + public void testInstallAppInternalLocPrefIsInternal() throws IOException, InterruptedException, + InstallException, TimeoutException, AdbCommandRejectedException, + ShellCommandUnresponsiveException { Log.i(LOG_TAG, "Test installLocation=internal, prefer=internal is installed on device"); installAppInternalLoc(PackageManagerHostTestUtils.InstallLocPreference.INTERNAL, PackageManagerHostTestUtils.InstallLocation.DEVICE); @@ -339,10 +398,17 @@ public class PackageManagerHostTests extends DeviceTestCase { * will install the app to the device when device's preference is external. * <p/> * Assumes adb is running as root in device under test. - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws InstallException if the install failed. */ - public void testInstallAppInternalLocPrefIsExternal() throws IOException, InterruptedException { + public void testInstallAppInternalLocPrefIsExternal() throws IOException, InterruptedException, + InstallException, TimeoutException, AdbCommandRejectedException, + ShellCommandUnresponsiveException { Log.i(LOG_TAG, "Test installLocation=internal, prefer=external is installed on device"); installAppInternalLoc(PackageManagerHostTestUtils.InstallLocPreference.EXTERNAL, PackageManagerHostTestUtils.InstallLocation.DEVICE); @@ -355,12 +421,18 @@ public class PackageManagerHostTests extends DeviceTestCase { * Assumes adb is running as root in device under test. * @param preference the device's preferred location of where to install apps * @param expectedLocation the expected location of where the apk was installed - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws InstallException if the install failed. */ public void installAppExternalLoc(PackageManagerHostTestUtils.InstallLocPreference preference, PackageManagerHostTestUtils.InstallLocation expectedLocation) - throws IOException, InterruptedException { + throws IOException, InterruptedException, TimeoutException, AdbCommandRejectedException, + ShellCommandUnresponsiveException, InstallException { PackageManagerHostTestUtils.InstallLocPreference savedPref = PackageManagerHostTestUtils.InstallLocPreference.AUTO; @@ -384,10 +456,17 @@ public class PackageManagerHostTests extends DeviceTestCase { * will install the app to the device when device's preference is auto. * <p/> * Assumes adb is running as root in device under test. - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws InstallException if the install failed. */ - public void testInstallAppExternalLocPrefIsAuto() throws IOException, InterruptedException { + public void testInstallAppExternalLocPrefIsAuto() throws IOException, InterruptedException, + InstallException, TimeoutException, AdbCommandRejectedException, + ShellCommandUnresponsiveException { Log.i(LOG_TAG, "Test installLocation=external, pref=auto gets installed on SD Card"); installAppExternalLoc(PackageManagerHostTestUtils.InstallLocPreference.AUTO, PackageManagerHostTestUtils.InstallLocation.SDCARD); @@ -398,10 +477,17 @@ public class PackageManagerHostTests extends DeviceTestCase { * will install the app to the device when device's preference is internal. * <p/> * Assumes adb is running as root in device under test. - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws InstallException if the install failed. */ - public void testInstallAppExternalLocPrefIsInternal() throws IOException, InterruptedException { + public void testInstallAppExternalLocPrefIsInternal() throws IOException, InterruptedException, + InstallException, TimeoutException, AdbCommandRejectedException, + ShellCommandUnresponsiveException { Log.i(LOG_TAG, "Test installLocation=external, pref=internal gets installed on SD Card"); installAppExternalLoc(PackageManagerHostTestUtils.InstallLocPreference.INTERNAL, PackageManagerHostTestUtils.InstallLocation.SDCARD); @@ -412,10 +498,17 @@ public class PackageManagerHostTests extends DeviceTestCase { * will install the app to the device when device's preference is external. * <p/> * Assumes adb is running as root in device under test. - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws InstallException if the install failed. */ - public void testInstallAppExternalLocPrefIsExternal() throws IOException, InterruptedException { + public void testInstallAppExternalLocPrefIsExternal() throws IOException, InterruptedException, + InstallException, TimeoutException, AdbCommandRejectedException, + ShellCommandUnresponsiveException { Log.i(LOG_TAG, "Test installLocation=external, pref=external gets installed on SD Card"); installAppExternalLoc(PackageManagerHostTestUtils.InstallLocPreference.EXTERNAL, PackageManagerHostTestUtils.InstallLocation.SDCARD); @@ -427,10 +520,17 @@ public class PackageManagerHostTests extends DeviceTestCase { * system decide. * <p/> * Assumes adb is running as root in device under test. - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws InstallException if the install failed. */ - public void testInstallAppNoLocPrefIsAuto() throws IOException, InterruptedException { + public void testInstallAppNoLocPrefIsAuto() throws IOException, InterruptedException, + TimeoutException, AdbCommandRejectedException, ShellCommandUnresponsiveException, + InstallException { Log.i(LOG_TAG, "Test an app with no installLocation gets installed on device"); PackageManagerHostTestUtils.InstallLocPreference savedPref = @@ -456,10 +556,17 @@ public class PackageManagerHostTests extends DeviceTestCase { * external. * <p/> * Assumes adb is running as root in device under test. - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws InstallException if the install failed. */ - public void testInstallAppNoLocPrefIsExternal() throws IOException, InterruptedException { + public void testInstallAppNoLocPrefIsExternal() throws IOException, InterruptedException, + TimeoutException, AdbCommandRejectedException, ShellCommandUnresponsiveException, + InstallException { Log.i(LOG_TAG, "Test an app with no installLocation gets installed on SD card"); PackageManagerHostTestUtils.InstallLocPreference savedPref = @@ -485,10 +592,17 @@ public class PackageManagerHostTests extends DeviceTestCase { * internal. * <p/> * Assumes adb is running as root in device under test. - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws InstallException if the install failed. */ - public void testInstallAppNoLocPrefIsInternal() throws IOException, InterruptedException { + public void testInstallAppNoLocPrefIsInternal() throws IOException, InterruptedException, + TimeoutException, AdbCommandRejectedException, ShellCommandUnresponsiveException, + InstallException { Log.i(LOG_TAG, "Test an app with no installLocation gets installed on device"); PackageManagerHostTestUtils.InstallLocPreference savedPref = @@ -513,10 +627,18 @@ public class PackageManagerHostTests extends DeviceTestCase { * forward-locked will get installed to the correct location. * <p/> * Assumes adb is running as root in device under test. - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws SyncException if the sync failed for another reason. + * @throws InstallException if the install failed. */ - public void testInstallFwdLockedAppInternal() throws IOException, InterruptedException { + public void testInstallFwdLockedAppInternal() throws IOException, InterruptedException, + InstallException, SyncException, TimeoutException, AdbCommandRejectedException, + ShellCommandUnresponsiveException { Log.i(LOG_TAG, "Test an app with installLoc set to Internal gets installed to app-private"); try { @@ -534,10 +656,18 @@ public class PackageManagerHostTests extends DeviceTestCase { * forward-locked will get installed to the correct location. * <p/> * Assumes adb is running as root in device under test. - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws SyncException if the sync failed for another reason. + * @throws InstallException if the install failed. */ - public void testInstallFwdLockedAppExternal() throws IOException, InterruptedException { + public void testInstallFwdLockedAppExternal() throws IOException, InterruptedException, + InstallException, SyncException, TimeoutException, AdbCommandRejectedException, + ShellCommandUnresponsiveException { Log.i(LOG_TAG, "Test an app with installLoc set to Internal gets installed to app-private"); try { @@ -555,10 +685,18 @@ public class PackageManagerHostTests extends DeviceTestCase { * forward-locked will get installed to the correct location. * <p/> * Assumes adb is running as root in device under test. - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws SyncException if the sync failed for another reason. + * @throws InstallException if the install failed. */ - public void testInstallFwdLockedAppAuto() throws IOException, InterruptedException { + public void testInstallFwdLockedAppAuto() throws IOException, InterruptedException, + InstallException, SyncException, TimeoutException, AdbCommandRejectedException, + ShellCommandUnresponsiveException { Log.i(LOG_TAG, "Test an app with installLoc set to Auto gets installed to app-private"); try { @@ -576,10 +714,18 @@ public class PackageManagerHostTests extends DeviceTestCase { * forward-locked installed will get installed to the correct location. * <p/> * Assumes adb is running as root in device under test. - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws SyncException if the sync failed for another reason. + * @throws InstallException if the install failed. */ - public void testInstallFwdLockedAppNone() throws IOException, InterruptedException { + public void testInstallFwdLockedAppNone() throws IOException, InterruptedException, + InstallException, SyncException, TimeoutException, AdbCommandRejectedException, + ShellCommandUnresponsiveException { Log.i(LOG_TAG, "Test an app with no installLoc set gets installed to app-private"); try { @@ -597,14 +743,21 @@ public class PackageManagerHostTests extends DeviceTestCase { * uninstall it, and reinstall it onto the SD card. * <p/> * Assumes adb is running as root in device under test. - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws InstallException if the install failed. */ // TODO: This currently relies on the app's manifest to switch from device to // SD card install locations. We might want to make Device's installPackage() // accept a installLocation flag so we can install a package to the // destination of our choosing. - public void testReinstallInternalToExternal() throws IOException, InterruptedException { + public void testReinstallInternalToExternal() throws IOException, InterruptedException, + InstallException, TimeoutException, AdbCommandRejectedException, + ShellCommandUnresponsiveException { Log.i(LOG_TAG, "Test installing an app first to the device, then to the SD Card"); try { @@ -625,14 +778,21 @@ public class PackageManagerHostTests extends DeviceTestCase { * uninstall it, and reinstall it onto the device. * <p/> * Assumes adb is running as root in device under test. - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws InstallException if the install failed. */ // TODO: This currently relies on the app's manifest to switch from device to // SD card install locations. We might want to make Device's installPackage() // accept a installLocation flag so we can install a package to the // destination of our choosing. - public void testReinstallExternalToInternal() throws IOException, InterruptedException { + public void testReinstallExternalToInternal() throws IOException, InterruptedException, + InstallException, TimeoutException, AdbCommandRejectedException, + ShellCommandUnresponsiveException { Log.i(LOG_TAG, "Test installing an app first to the SD Care, then to the device"); try { @@ -655,10 +815,16 @@ public class PackageManagerHostTests extends DeviceTestCase { * the update onto the SD card as well when location is set to external for both versions * <p/> * Assumes adb is running as root in device under test. - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws InstallException if the install failed. */ - public void testUpdateBothExternal() throws IOException, InterruptedException { + public void testUpdateBothExternal() throws IOException, InterruptedException, InstallException, + TimeoutException, AdbCommandRejectedException, ShellCommandUnresponsiveException { Log.i(LOG_TAG, "Test updating an app on the SD card stays on the SD card"); try { @@ -681,10 +847,16 @@ public class PackageManagerHostTests extends DeviceTestCase { * updated apps' manifest file. * <p/> * Assumes adb is running as root in device under test. - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws InstallException if the install failed. */ - public void testUpdateToSDCard() throws IOException, InterruptedException { + public void testUpdateToSDCard() throws IOException, InterruptedException, InstallException, + TimeoutException, AdbCommandRejectedException, ShellCommandUnresponsiveException { Log.i(LOG_TAG, "Test updating an app on the SD card stays on the SD card"); try { @@ -706,10 +878,17 @@ public class PackageManagerHostTests extends DeviceTestCase { * the update onto the device if the manifest has changed to installLocation=internalOnly * <p/> * Assumes adb is running as root in device under test. - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws InstallException if the install failed. */ - public void testUpdateSDCardToDevice() throws IOException, InterruptedException { + public void testUpdateSDCardToDevice() throws IOException, InterruptedException, + InstallException, TimeoutException, AdbCommandRejectedException, + ShellCommandUnresponsiveException { Log.i(LOG_TAG, "Test updating an app on the SD card to the Device through manifest change"); try { @@ -731,11 +910,18 @@ public class PackageManagerHostTests extends DeviceTestCase { * the update onto the device's forward-locked location * <p/> * Assumes adb is running as root in device under test. - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws SyncException if the sync failed for another reason. + * @throws InstallException if the install failed. */ public void testInstallAndUpdateExternalLocForwardLockedApp() - throws IOException, InterruptedException { + throws IOException, InterruptedException, InstallException, SyncException, + TimeoutException, AdbCommandRejectedException, ShellCommandUnresponsiveException { Log.i(LOG_TAG, "Test updating a forward-locked app marked preferExternal"); try { @@ -757,11 +943,18 @@ public class PackageManagerHostTests extends DeviceTestCase { * the update onto the device's forward-locked location * <p/> * Assumes adb is running as root in device under test. - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws SyncException if the sync failed for another reason. + * @throws InstallException if the install failed. */ public void testInstallAndUpdateNoLocForwardLockedApp() - throws IOException, InterruptedException { + throws IOException, InterruptedException, InstallException, SyncException, + TimeoutException, AdbCommandRejectedException, ShellCommandUnresponsiveException { Log.i(LOG_TAG, "Test updating a forward-locked app with no installLocation pref set"); try { @@ -783,11 +976,18 @@ public class PackageManagerHostTests extends DeviceTestCase { * and then launched without crashing. * <p/> * Assumes adb is running as root in device under test. - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws SyncException if the sync failed for another reason. + * @throws InstallException if the install failed. */ public void testInstallAndLaunchAllPermsAppOnSD() - throws IOException, InterruptedException { + throws IOException, InterruptedException, InstallException, TimeoutException, + AdbCommandRejectedException, ShellCommandUnresponsiveException { Log.i(LOG_TAG, "Test launching an app with all perms set, installed on SD card"); try { @@ -808,11 +1008,17 @@ public class PackageManagerHostTests extends DeviceTestCase { * run without permissions errors. * <p/> * Assumes adb is running as root in device under test. - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws InstallException if the install failed. */ public void testInstallAndLaunchFLPermsAppOnSD() - throws IOException, InterruptedException { + throws IOException, InterruptedException, InstallException, TimeoutException, + AdbCommandRejectedException, ShellCommandUnresponsiveException { Log.i(LOG_TAG, "Test launching an app with location perms set, installed on SD card"); try { @@ -833,11 +1039,17 @@ public class PackageManagerHostTests extends DeviceTestCase { * run without permissions errors. * <p/> * Assumes adb is running as root in device under test. - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws InstallException if the install failed. */ public void testInstallAndLaunchBTPermsAppOnSD() - throws IOException, InterruptedException { + throws IOException, InterruptedException, InstallException, TimeoutException, + AdbCommandRejectedException, ShellCommandUnresponsiveException { Log.i(LOG_TAG, "Test launching an app with bluetooth perms set, installed on SD card"); try { @@ -858,11 +1070,17 @@ public class PackageManagerHostTests extends DeviceTestCase { * SecurityException when launched if its other shared apps are not installed. * <p/> * Assumes adb is running as root in device under test. - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws InstallException if the install failed. */ public void testInstallAndLaunchSharedPermsAppOnSD_NoPerms() - throws IOException, InterruptedException { + throws IOException, InterruptedException, InstallException, TimeoutException, + AdbCommandRejectedException, ShellCommandUnresponsiveException { Log.i(LOG_TAG, "Test launching an app with no explicit perms set, installed on SD card"); try { @@ -888,11 +1106,17 @@ public class PackageManagerHostTests extends DeviceTestCase { * shared apps are installed. * <p/> * Assumes adb is running as root in device under test. - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws InstallException if the install failed. */ public void testInstallAndLaunchSharedPermsAppOnSD_GrantedPerms() - throws IOException, InterruptedException { + throws IOException, InterruptedException, InstallException, TimeoutException, + AdbCommandRejectedException, ShellCommandUnresponsiveException { Log.i(LOG_TAG, "Test launching an app with no explicit perms set, installed on SD card"); try { @@ -921,11 +1145,17 @@ public class PackageManagerHostTests extends DeviceTestCase { * run without permissions errors even after a reboot * <p/> * Assumes adb is running as root in device under test. - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws InstallException if the install failed. */ public void testInstallAndLaunchFLPermsAppOnSD_Reboot() - throws IOException, InterruptedException { + throws IOException, InterruptedException, InstallException, TimeoutException, + AdbCommandRejectedException, ShellCommandUnresponsiveException { Log.i(LOG_TAG, "Test launching an app with location perms set, installed on SD card"); try { @@ -951,11 +1181,17 @@ public class PackageManagerHostTests extends DeviceTestCase { * shared apps are installed, even after a reboot. * <p/> * Assumes adb is running as root in device under test. - * @throws IOException if adb shell command failed * @throws InterruptedException if the thread was interrupted + * @throws TimeoutException in case of a timeout on the connection. + * @throws AdbCommandRejectedException if adb rejects the command + * @throws ShellCommandUnresponsiveException if the device did not output anything for + * a period longer than the max time to output. + * @throws IOException if connection to device was lost. + * @throws InstallException if the install failed. */ public void testInstallAndLaunchSharedPermsAppOnSD_Reboot() - throws IOException, InterruptedException { + throws IOException, InterruptedException, InstallException, TimeoutException, + AdbCommandRejectedException, ShellCommandUnresponsiveException { Log.i(LOG_TAG, "Test launching an app on SD, with no explicit perms set after reboot"); try { diff --git a/core/tests/hosttests/src/android/content/pm/PackageManagerStressHostTests.java b/core/tests/hosttests/src/android/content/pm/PackageManagerStressHostTests.java index 715c55b..a2a5dd3 100644 --- a/core/tests/hosttests/src/android/content/pm/PackageManagerStressHostTests.java +++ b/core/tests/hosttests/src/android/content/pm/PackageManagerStressHostTests.java @@ -16,8 +16,11 @@ package android.content.pm; -import com.android.ddmlib.IDevice; +import com.android.ddmlib.AdbCommandRejectedException; +import com.android.ddmlib.InstallException; import com.android.ddmlib.Log; +import com.android.ddmlib.ShellCommandUnresponsiveException; +import com.android.ddmlib.TimeoutException; import com.android.hosttest.DeviceTestCase; import com.android.hosttest.DeviceTestSuite; @@ -138,7 +141,9 @@ public class PackageManagerStressHostTests extends DeviceTestCase { * <p/> * Assumes adb is running as root in device under test. */ - public void testUpdateAppManyTimesOnSD() throws IOException, InterruptedException { + public void testUpdateAppManyTimesOnSD() throws IOException, InterruptedException, + InstallException, TimeoutException, AdbCommandRejectedException, + ShellCommandUnresponsiveException { Log.i(LOG_TAG, "Test updating an app on SD numerous times"); // cleanup test app just in case it already exists @@ -173,7 +178,9 @@ public class PackageManagerStressHostTests extends DeviceTestCase { * <p/> * Assumes adb is running as root in device under test. */ - public void testUninstallReinstallAppOnSDManyTimes() throws IOException, InterruptedException { + public void testUninstallReinstallAppOnSDManyTimes() throws IOException, InterruptedException, + InstallException, TimeoutException, AdbCommandRejectedException, + ShellCommandUnresponsiveException { Log.i(LOG_TAG, "Test updating an app on the SD card stays on the SD card"); // cleanup test app just in case it was already exists @@ -207,7 +214,9 @@ public class PackageManagerStressHostTests extends DeviceTestCase { * <p/> * Assumes adb is running as root in device under test. */ - public void testInstallManyLargeAppsOnSD() throws IOException, InterruptedException { + public void testInstallManyLargeAppsOnSD() throws IOException, InterruptedException, + InstallException, TimeoutException, AdbCommandRejectedException, + ShellCommandUnresponsiveException { Log.i(LOG_TAG, "Test installing 20 large apps onto the sd card"); try { @@ -251,7 +260,9 @@ public class PackageManagerStressHostTests extends DeviceTestCase { * <p/> * Assumes adb is running as root in device under test. */ - public void testInstallManyAppsOnSD() throws IOException, InterruptedException { + public void testInstallManyAppsOnSD() throws IOException, InterruptedException, + InstallException, TimeoutException, AdbCommandRejectedException, + ShellCommandUnresponsiveException { Log.i(LOG_TAG, "Test installing 500 small apps onto SD"); try { diff --git a/docs/html/guide/topics/resources/animation-resource.jd b/docs/html/guide/topics/resources/animation-resource.jd index e0ce051..972dd72 100644 --- a/docs/html/guide/topics/resources/animation-resource.jd +++ b/docs/html/guide/topics/resources/animation-resource.jd @@ -65,10 +65,10 @@ In XML: <code>@[<em>package</em>:]anim/<em>filename</em></code> android:pivotX="<em>float</em>" android:pivotY="<em>float</em>" /> <<a href="#translate-element">translate</a> - android:fromX="<em>float</em>" - android:toX="<em>float</em>" - android:fromY="<em>float</em>" - android:toY="<em>float</em>" /> + android:fromXDelta="<em>float</em>" + android:toXDelta="<em>float</em>" + android:fromYDelta="<em>float</em>" + android:toYDelta="<em>float</em>" /> <<a href="#rotate-element">rotate</a> android:fromDegrees="<em>float</em>" android:toDegrees="<em>float</em>" @@ -212,10 +212,10 @@ inherrited by this element).</p> android:shareInterpolator="false"> <scale android:interpolator="@android:anim/accelerate_decelerate_interpolator" - android:fromXScale="1.0" - android:toXScale="1.4" - android:fromYScale="1.0" - android:toYScale="0.6" + android:fromXScale="1.0" + android:toXScale="1.4" + android:fromYScale="1.0" + android:toYScale="0.6" android:pivotX="50%" android:pivotY="50%" android:fillAfter="false" @@ -224,18 +224,18 @@ inherrited by this element).</p> android:interpolator="@android:anim/accelerate_interpolator" android:startOffset="700"> <scale - android:fromXScale="1.4" + android:fromXScale="1.4" android:toXScale="0.0" android:fromYScale="0.6" - android:toYScale="0.0" - android:pivotX="50%" - android:pivotY="50%" + android:toYScale="0.0" + android:pivotX="50%" + android:pivotY="50%" android:duration="400" /> <rotate - android:fromDegrees="0" + android:fromDegrees="0" android:toDegrees="-45" - android:toYScale="0.0" - android:pivotX="50%" + android:toYScale="0.0" + android:pivotX="50%" android:pivotY="50%" android:duration="400" /> </set> diff --git a/media/mediaserver/Android.mk b/media/mediaserver/Android.mk index a92cea8..0559812 100644 --- a/media/mediaserver/Android.mk +++ b/media/mediaserver/Android.mk @@ -14,8 +14,8 @@ LOCAL_SHARED_LIBRARIES := \ base := $(LOCAL_PATH)/../.. LOCAL_C_INCLUDES := \ - $(base)/libs/audioflinger \ - $(base)/camera/libcameraservice \ + $(base)/services/audioflinger \ + $(base)/services/camera/libcameraservice \ $(base)/media/libmediaplayerservice LOCAL_MODULE:= mediaserver diff --git a/libs/audioflinger/A2dpAudioInterface.cpp b/services/audioflinger/A2dpAudioInterface.cpp index 995e31c..995e31c 100644 --- a/libs/audioflinger/A2dpAudioInterface.cpp +++ b/services/audioflinger/A2dpAudioInterface.cpp diff --git a/libs/audioflinger/A2dpAudioInterface.h b/services/audioflinger/A2dpAudioInterface.h index 48154f9..48154f9 100644 --- a/libs/audioflinger/A2dpAudioInterface.h +++ b/services/audioflinger/A2dpAudioInterface.h diff --git a/libs/audioflinger/Android.mk b/services/audioflinger/Android.mk index 870c0b8..870c0b8 100644 --- a/libs/audioflinger/Android.mk +++ b/services/audioflinger/Android.mk diff --git a/libs/audioflinger/AudioBufferProvider.h b/services/audioflinger/AudioBufferProvider.h index 81c5c39..81c5c39 100644 --- a/libs/audioflinger/AudioBufferProvider.h +++ b/services/audioflinger/AudioBufferProvider.h diff --git a/libs/audioflinger/AudioDumpInterface.cpp b/services/audioflinger/AudioDumpInterface.cpp index a018b4c..a018b4c 100644 --- a/libs/audioflinger/AudioDumpInterface.cpp +++ b/services/audioflinger/AudioDumpInterface.cpp diff --git a/libs/audioflinger/AudioDumpInterface.h b/services/audioflinger/AudioDumpInterface.h index 4c62b3e..4c62b3e 100644 --- a/libs/audioflinger/AudioDumpInterface.h +++ b/services/audioflinger/AudioDumpInterface.h diff --git a/libs/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp index 2414e8d..2414e8d 100644 --- a/libs/audioflinger/AudioFlinger.cpp +++ b/services/audioflinger/AudioFlinger.cpp diff --git a/libs/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h index 739ec33..739ec33 100644 --- a/libs/audioflinger/AudioFlinger.h +++ b/services/audioflinger/AudioFlinger.h diff --git a/libs/audioflinger/AudioHardwareGeneric.cpp b/services/audioflinger/AudioHardwareGeneric.cpp index d63c031..d63c031 100644 --- a/libs/audioflinger/AudioHardwareGeneric.cpp +++ b/services/audioflinger/AudioHardwareGeneric.cpp diff --git a/libs/audioflinger/AudioHardwareGeneric.h b/services/audioflinger/AudioHardwareGeneric.h index aa4e78d..aa4e78d 100644 --- a/libs/audioflinger/AudioHardwareGeneric.h +++ b/services/audioflinger/AudioHardwareGeneric.h diff --git a/libs/audioflinger/AudioHardwareInterface.cpp b/services/audioflinger/AudioHardwareInterface.cpp index 9a4a7f9..9a4a7f9 100644 --- a/libs/audioflinger/AudioHardwareInterface.cpp +++ b/services/audioflinger/AudioHardwareInterface.cpp diff --git a/libs/audioflinger/AudioHardwareStub.cpp b/services/audioflinger/AudioHardwareStub.cpp index d481150..d481150 100644 --- a/libs/audioflinger/AudioHardwareStub.cpp +++ b/services/audioflinger/AudioHardwareStub.cpp diff --git a/libs/audioflinger/AudioHardwareStub.h b/services/audioflinger/AudioHardwareStub.h index 06a29de..06a29de 100644 --- a/libs/audioflinger/AudioHardwareStub.h +++ b/services/audioflinger/AudioHardwareStub.h diff --git a/libs/audioflinger/AudioMixer.cpp b/services/audioflinger/AudioMixer.cpp index 19a442a..19a442a 100644 --- a/libs/audioflinger/AudioMixer.cpp +++ b/services/audioflinger/AudioMixer.cpp diff --git a/libs/audioflinger/AudioMixer.h b/services/audioflinger/AudioMixer.h index 15766cd..15766cd 100644 --- a/libs/audioflinger/AudioMixer.h +++ b/services/audioflinger/AudioMixer.h diff --git a/libs/audioflinger/AudioPolicyManagerBase.cpp b/services/audioflinger/AudioPolicyManagerBase.cpp index c8b3f48..c8b3f48 100644 --- a/libs/audioflinger/AudioPolicyManagerBase.cpp +++ b/services/audioflinger/AudioPolicyManagerBase.cpp diff --git a/libs/audioflinger/AudioPolicyService.cpp b/services/audioflinger/AudioPolicyService.cpp index bb3905c..bb3905c 100644 --- a/libs/audioflinger/AudioPolicyService.cpp +++ b/services/audioflinger/AudioPolicyService.cpp diff --git a/libs/audioflinger/AudioPolicyService.h b/services/audioflinger/AudioPolicyService.h index a13d0bd..a13d0bd 100644 --- a/libs/audioflinger/AudioPolicyService.h +++ b/services/audioflinger/AudioPolicyService.h diff --git a/libs/audioflinger/AudioResampler.cpp b/services/audioflinger/AudioResampler.cpp index 5dabacb..5dabacb 100644 --- a/libs/audioflinger/AudioResampler.cpp +++ b/services/audioflinger/AudioResampler.cpp diff --git a/libs/audioflinger/AudioResampler.h b/services/audioflinger/AudioResampler.h index 2dfac76..2dfac76 100644 --- a/libs/audioflinger/AudioResampler.h +++ b/services/audioflinger/AudioResampler.h diff --git a/libs/audioflinger/AudioResamplerCubic.cpp b/services/audioflinger/AudioResamplerCubic.cpp index 1d247bd..1d247bd 100644 --- a/libs/audioflinger/AudioResamplerCubic.cpp +++ b/services/audioflinger/AudioResamplerCubic.cpp diff --git a/libs/audioflinger/AudioResamplerCubic.h b/services/audioflinger/AudioResamplerCubic.h index b72b62a..b72b62a 100644 --- a/libs/audioflinger/AudioResamplerCubic.h +++ b/services/audioflinger/AudioResamplerCubic.h diff --git a/libs/audioflinger/AudioResamplerSinc.cpp b/services/audioflinger/AudioResamplerSinc.cpp index 9e5e254..9e5e254 100644 --- a/libs/audioflinger/AudioResamplerSinc.cpp +++ b/services/audioflinger/AudioResamplerSinc.cpp diff --git a/libs/audioflinger/AudioResamplerSinc.h b/services/audioflinger/AudioResamplerSinc.h index e6cb90b..e6cb90b 100644 --- a/libs/audioflinger/AudioResamplerSinc.h +++ b/services/audioflinger/AudioResamplerSinc.h diff --git a/camera/libcameraservice/Android.mk b/services/camera/libcameraservice/Android.mk index df5c166..df5c166 100644 --- a/camera/libcameraservice/Android.mk +++ b/services/camera/libcameraservice/Android.mk diff --git a/camera/libcameraservice/CameraHardwareStub.cpp b/services/camera/libcameraservice/CameraHardwareStub.cpp index 8b66389..8b66389 100644 --- a/camera/libcameraservice/CameraHardwareStub.cpp +++ b/services/camera/libcameraservice/CameraHardwareStub.cpp diff --git a/camera/libcameraservice/CameraHardwareStub.h b/services/camera/libcameraservice/CameraHardwareStub.h index 957813a4..957813a4 100644 --- a/camera/libcameraservice/CameraHardwareStub.h +++ b/services/camera/libcameraservice/CameraHardwareStub.h diff --git a/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp index 00bd54e..00bd54e 100644 --- a/camera/libcameraservice/CameraService.cpp +++ b/services/camera/libcameraservice/CameraService.cpp diff --git a/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h index bc49b1d..bc49b1d 100644 --- a/camera/libcameraservice/CameraService.h +++ b/services/camera/libcameraservice/CameraService.h diff --git a/camera/libcameraservice/CannedJpeg.h b/services/camera/libcameraservice/CannedJpeg.h index b6266fb..b6266fb 100644 --- a/camera/libcameraservice/CannedJpeg.h +++ b/services/camera/libcameraservice/CannedJpeg.h diff --git a/camera/libcameraservice/FakeCamera.cpp b/services/camera/libcameraservice/FakeCamera.cpp index 6749899..6749899 100644 --- a/camera/libcameraservice/FakeCamera.cpp +++ b/services/camera/libcameraservice/FakeCamera.cpp diff --git a/camera/libcameraservice/FakeCamera.h b/services/camera/libcameraservice/FakeCamera.h index f7f8803..f7f8803 100644 --- a/camera/libcameraservice/FakeCamera.h +++ b/services/camera/libcameraservice/FakeCamera.h diff --git a/camera/tests/CameraServiceTest/Android.mk b/services/camera/tests/CameraServiceTest/Android.mk index 9bb190a..9bb190a 100644 --- a/camera/tests/CameraServiceTest/Android.mk +++ b/services/camera/tests/CameraServiceTest/Android.mk diff --git a/camera/tests/CameraServiceTest/CameraServiceTest.cpp b/services/camera/tests/CameraServiceTest/CameraServiceTest.cpp index 9fc795b..9fc795b 100644 --- a/camera/tests/CameraServiceTest/CameraServiceTest.cpp +++ b/services/camera/tests/CameraServiceTest/CameraServiceTest.cpp diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java index 88463b0..68787cd 100644 --- a/services/java/com/android/server/WindowManagerService.java +++ b/services/java/com/android/server/WindowManagerService.java @@ -2149,6 +2149,7 @@ public class WindowManagerService extends IWindowManager.Stub private void removeWindowInnerLocked(Session session, WindowState win) { mKeyWaiter.finishedKey(session, win.mClient, true, KeyWaiter.RETURN_NOTHING); + mKeyWaiter.releaseMotionTarget(win); mKeyWaiter.releasePendingPointerLocked(win.mSession); mKeyWaiter.releasePendingTrackballLocked(win.mSession); @@ -6120,6 +6121,12 @@ public class WindowManagerService extends IWindowManager.Stub } } + void releaseMotionTarget(WindowState win) { + if (mMotionTarget == win) { + mMotionTarget = null; + } + } + MotionEvent finishedKey(Session session, IWindow client, boolean force, int returnWhat) { if (DEBUG_INPUT) Slog.v( diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index 0c11940..a388311 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -52,6 +52,7 @@ import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.ContentResolver; import android.content.Context; +import android.content.DialogInterface; import android.content.Intent; import android.content.IntentFilter; import android.content.IIntentReceiver; @@ -1176,7 +1177,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen d.setCancelable(false); d.setTitle("System UIDs Inconsistent"); d.setMessage("UIDs on the system are inconsistent, you need to wipe your data partition or your device will be unstable."); - d.setButton("I'm Feeling Lucky", + d.setButton(DialogInterface.BUTTON_POSITIVE, "I'm Feeling Lucky", mHandler.obtainMessage(IM_FEELING_LUCKY_MSG)); mUidAlert = d; d.show(); @@ -5879,10 +5880,12 @@ public final class ActivityManagerService extends ActivityManagerNative implemen String[] pkgs = intent.getStringArrayExtra(Intent.EXTRA_PACKAGES); if (pkgs != null) { for (String pkg : pkgs) { - if (forceStopPackageLocked(pkg, -1, false, false, false)) { - setResultCode(Activity.RESULT_OK); - return; - } + synchronized (ActivityManagerService.this) { + if (forceStopPackageLocked(pkg, -1, false, false, false)) { + setResultCode(Activity.RESULT_OK); + return; + } + } } } } diff --git a/services/java/com/android/server/am/AppWaitingForDebuggerDialog.java b/services/java/com/android/server/am/AppWaitingForDebuggerDialog.java index 8e9818d..9fb48b3 100644 --- a/services/java/com/android/server/am/AppWaitingForDebuggerDialog.java +++ b/services/java/com/android/server/am/AppWaitingForDebuggerDialog.java @@ -17,6 +17,7 @@ package com.android.server.am; import android.content.Context; +import android.content.DialogInterface; import android.os.Handler; import android.os.Message; @@ -49,7 +50,7 @@ class AppWaitingForDebuggerDialog extends BaseErrorDialog { text.append(" is waiting for the debugger to attach."); setMessage(text.toString()); - setButton("Force Close", mHandler.obtainMessage(1, app)); + setButton(DialogInterface.BUTTON_POSITIVE, "Force Close", mHandler.obtainMessage(1, app)); setTitle("Waiting For Debugger"); getWindow().setTitle("Waiting For Debugger: " + app.info.processName); } diff --git a/services/java/com/android/server/am/FactoryErrorDialog.java b/services/java/com/android/server/am/FactoryErrorDialog.java index 2e25474..b19bb5c 100644 --- a/services/java/com/android/server/am/FactoryErrorDialog.java +++ b/services/java/com/android/server/am/FactoryErrorDialog.java @@ -17,6 +17,7 @@ package com.android.server.am; import android.content.Context; +import android.content.DialogInterface; import android.os.Handler; import android.os.Message; @@ -26,7 +27,8 @@ class FactoryErrorDialog extends BaseErrorDialog { setCancelable(false); setTitle(context.getText(com.android.internal.R.string.factorytest_failed)); setMessage(msg); - setButton(context.getText(com.android.internal.R.string.factorytest_reboot), + setButton(DialogInterface.BUTTON_POSITIVE, + context.getText(com.android.internal.R.string.factorytest_reboot), mHandler.obtainMessage(0)); getWindow().setTitle("Factory Error"); } diff --git a/libs/surfaceflinger/Android.mk b/services/surfaceflinger/Android.mk index 86eb78d..86eb78d 100644 --- a/libs/surfaceflinger/Android.mk +++ b/services/surfaceflinger/Android.mk diff --git a/libs/surfaceflinger/Barrier.h b/services/surfaceflinger/Barrier.h index e2bcf6a..e2bcf6a 100644 --- a/libs/surfaceflinger/Barrier.h +++ b/services/surfaceflinger/Barrier.h diff --git a/libs/surfaceflinger/BlurFilter.cpp b/services/surfaceflinger/BlurFilter.cpp index 1ffbd5b..1ffbd5b 100644 --- a/libs/surfaceflinger/BlurFilter.cpp +++ b/services/surfaceflinger/BlurFilter.cpp diff --git a/libs/surfaceflinger/BlurFilter.h b/services/surfaceflinger/BlurFilter.h index 294db43..294db43 100644 --- a/libs/surfaceflinger/BlurFilter.h +++ b/services/surfaceflinger/BlurFilter.h diff --git a/libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp b/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp index ea68352..ea68352 100644 --- a/libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp +++ b/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp diff --git a/libs/surfaceflinger/DisplayHardware/DisplayHardware.h b/services/surfaceflinger/DisplayHardware/DisplayHardware.h index df046af..df046af 100644 --- a/libs/surfaceflinger/DisplayHardware/DisplayHardware.h +++ b/services/surfaceflinger/DisplayHardware/DisplayHardware.h diff --git a/libs/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp b/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp index 1d09f84..1d09f84 100644 --- a/libs/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp +++ b/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp diff --git a/libs/surfaceflinger/DisplayHardware/DisplayHardwareBase.h b/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.h index 8369bb8..8369bb8 100644 --- a/libs/surfaceflinger/DisplayHardware/DisplayHardwareBase.h +++ b/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.h diff --git a/libs/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index ce7e9aa..ce7e9aa 100644 --- a/libs/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp diff --git a/libs/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h index 743afb4..743afb4 100644 --- a/libs/surfaceflinger/Layer.h +++ b/services/surfaceflinger/Layer.h diff --git a/libs/surfaceflinger/LayerBase.cpp b/services/surfaceflinger/LayerBase.cpp index a8b735e..a8b735e 100644 --- a/libs/surfaceflinger/LayerBase.cpp +++ b/services/surfaceflinger/LayerBase.cpp diff --git a/libs/surfaceflinger/LayerBase.h b/services/surfaceflinger/LayerBase.h index 62ec839..62ec839 100644 --- a/libs/surfaceflinger/LayerBase.h +++ b/services/surfaceflinger/LayerBase.h diff --git a/libs/surfaceflinger/LayerBlur.cpp b/services/surfaceflinger/LayerBlur.cpp index 5fd7904..5fd7904 100644 --- a/libs/surfaceflinger/LayerBlur.cpp +++ b/services/surfaceflinger/LayerBlur.cpp diff --git a/libs/surfaceflinger/LayerBlur.h b/services/surfaceflinger/LayerBlur.h index 5b63dec..5b63dec 100644 --- a/libs/surfaceflinger/LayerBlur.h +++ b/services/surfaceflinger/LayerBlur.h diff --git a/libs/surfaceflinger/LayerBuffer.cpp b/services/surfaceflinger/LayerBuffer.cpp index 5c21593..5c21593 100644 --- a/libs/surfaceflinger/LayerBuffer.cpp +++ b/services/surfaceflinger/LayerBuffer.cpp diff --git a/libs/surfaceflinger/LayerBuffer.h b/services/surfaceflinger/LayerBuffer.h index b176623..b176623 100644 --- a/libs/surfaceflinger/LayerBuffer.h +++ b/services/surfaceflinger/LayerBuffer.h diff --git a/libs/surfaceflinger/LayerDim.cpp b/services/surfaceflinger/LayerDim.cpp index fd61e30..fd61e30 100644 --- a/libs/surfaceflinger/LayerDim.cpp +++ b/services/surfaceflinger/LayerDim.cpp diff --git a/libs/surfaceflinger/LayerDim.h b/services/surfaceflinger/LayerDim.h index d4672a1..d4672a1 100644 --- a/libs/surfaceflinger/LayerDim.h +++ b/services/surfaceflinger/LayerDim.h diff --git a/libs/surfaceflinger/MODULE_LICENSE_APACHE2 b/services/surfaceflinger/MODULE_LICENSE_APACHE2 index e69de29..e69de29 100644 --- a/libs/surfaceflinger/MODULE_LICENSE_APACHE2 +++ b/services/surfaceflinger/MODULE_LICENSE_APACHE2 diff --git a/libs/surfaceflinger/MessageQueue.cpp b/services/surfaceflinger/MessageQueue.cpp index b43d801..b43d801 100644 --- a/libs/surfaceflinger/MessageQueue.cpp +++ b/services/surfaceflinger/MessageQueue.cpp diff --git a/libs/surfaceflinger/MessageQueue.h b/services/surfaceflinger/MessageQueue.h index dc8138d..dc8138d 100644 --- a/libs/surfaceflinger/MessageQueue.h +++ b/services/surfaceflinger/MessageQueue.h diff --git a/libs/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 0722fda..0722fda 100644 --- a/libs/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp diff --git a/libs/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h index d75dc15..d75dc15 100644 --- a/libs/surfaceflinger/SurfaceFlinger.h +++ b/services/surfaceflinger/SurfaceFlinger.h diff --git a/libs/surfaceflinger/Tokenizer.cpp b/services/surfaceflinger/Tokenizer.cpp index be3a239..be3a239 100644 --- a/libs/surfaceflinger/Tokenizer.cpp +++ b/services/surfaceflinger/Tokenizer.cpp diff --git a/libs/surfaceflinger/Tokenizer.h b/services/surfaceflinger/Tokenizer.h index 6b3057d..6b3057d 100644 --- a/libs/surfaceflinger/Tokenizer.h +++ b/services/surfaceflinger/Tokenizer.h diff --git a/libs/surfaceflinger/Transform.cpp b/services/surfaceflinger/Transform.cpp index 175f989..175f989 100644 --- a/libs/surfaceflinger/Transform.cpp +++ b/services/surfaceflinger/Transform.cpp diff --git a/libs/surfaceflinger/Transform.h b/services/surfaceflinger/Transform.h index 2e5b893..2e5b893 100644 --- a/libs/surfaceflinger/Transform.h +++ b/services/surfaceflinger/Transform.h diff --git a/libs/surfaceflinger/clz.cpp b/services/surfaceflinger/clz.cpp index 2456b86..2456b86 100644 --- a/libs/surfaceflinger/clz.cpp +++ b/services/surfaceflinger/clz.cpp diff --git a/libs/surfaceflinger/clz.h b/services/surfaceflinger/clz.h index 0ddf986..0ddf986 100644 --- a/libs/surfaceflinger/clz.h +++ b/services/surfaceflinger/clz.h diff --git a/libs/surfaceflinger/tests/Android.mk b/services/surfaceflinger/tests/Android.mk index 5053e7d..5053e7d 100644 --- a/libs/surfaceflinger/tests/Android.mk +++ b/services/surfaceflinger/tests/Android.mk diff --git a/libs/surfaceflinger/tests/overlays/Android.mk b/services/surfaceflinger/tests/overlays/Android.mk index 592b601..592b601 100644 --- a/libs/surfaceflinger/tests/overlays/Android.mk +++ b/services/surfaceflinger/tests/overlays/Android.mk diff --git a/libs/surfaceflinger/tests/overlays/overlays.cpp b/services/surfaceflinger/tests/overlays/overlays.cpp index c248a61..c248a61 100644 --- a/libs/surfaceflinger/tests/overlays/overlays.cpp +++ b/services/surfaceflinger/tests/overlays/overlays.cpp diff --git a/libs/surfaceflinger/tests/resize/Android.mk b/services/surfaceflinger/tests/resize/Android.mk index 24c2d01..24c2d01 100644 --- a/libs/surfaceflinger/tests/resize/Android.mk +++ b/services/surfaceflinger/tests/resize/Android.mk diff --git a/libs/surfaceflinger/tests/resize/resize.cpp b/services/surfaceflinger/tests/resize/resize.cpp index 127cca3..127cca3 100644 --- a/libs/surfaceflinger/tests/resize/resize.cpp +++ b/services/surfaceflinger/tests/resize/resize.cpp diff --git a/telephony/java/com/android/internal/telephony/AdnRecordCache.java b/telephony/java/com/android/internal/telephony/AdnRecordCache.java index c8c0658..a175d49 100644 --- a/telephony/java/com/android/internal/telephony/AdnRecordCache.java +++ b/telephony/java/com/android/internal/telephony/AdnRecordCache.java @@ -186,7 +186,12 @@ public final class AdnRecordCache extends Handler implements IccConstants { } ArrayList<AdnRecord> oldAdnList; - oldAdnList = getRecordsIfLoaded(efid); + + if (efid == EF_PBR) { + oldAdnList = mUsimPhoneBookManager.loadEfFilesFromUsim(); + } else { + oldAdnList = getRecordsIfLoaded(efid); + } if (oldAdnList == null) { sendErrorResponse(response, "Adn list not exist for EF:" + efid); @@ -208,6 +213,17 @@ public final class AdnRecordCache extends Handler implements IccConstants { return; } + if (efid == EF_PBR) { + AdnRecord foundAdn = oldAdnList.get(index-1); + efid = foundAdn.efid; + extensionEF = foundAdn.extRecord; + index = foundAdn.recordNumber; + + newAdn.efid = efid; + newAdn.extRecord = extensionEF; + newAdn.recordNumber = index; + } + Message pendingResponse = userWriteResponse.get(efid); if (pendingResponse != null) { @@ -331,6 +347,7 @@ public final class AdnRecordCache extends Handler implements IccConstants { if (ar.exception == null) { adnLikeFiles.get(efid).set(index - 1, adn); + mUsimPhoneBookManager.invalidateCache(); } Message response = userWriteResponse.get(efid); diff --git a/telephony/java/com/android/internal/telephony/IccCard.java b/telephony/java/com/android/internal/telephony/IccCard.java index d3a34ec..90f9e8c 100644 --- a/telephony/java/com/android/internal/telephony/IccCard.java +++ b/telephony/java/com/android/internal/telephony/IccCard.java @@ -672,12 +672,11 @@ public abstract class IccCard { * @return true if a ICC card is present */ public boolean hasIccCard() { - boolean isIccPresent; - if (mPhone.getPhoneName().equals("GSM")) { - return mIccCardStatus.getCardState().isCardPresent(); - } else { - // TODO: Make work with a CDMA device with a RUIM card. + if (mIccCardStatus == null) { return false; + } else { + // Returns ICC card status for both GSM and CDMA mode + return mIccCardStatus.getCardState().isCardPresent(); } } diff --git a/telephony/java/com/android/internal/telephony/IccPhoneBookInterfaceManager.java b/telephony/java/com/android/internal/telephony/IccPhoneBookInterfaceManager.java index 48257cc..2f22d74 100644 --- a/telephony/java/com/android/internal/telephony/IccPhoneBookInterfaceManager.java +++ b/telephony/java/com/android/internal/telephony/IccPhoneBookInterfaceManager.java @@ -144,6 +144,9 @@ public abstract class IccPhoneBookInterfaceManager extends IIccPhoneBook.Stub { if (DBG) logd("updateAdnRecordsInEfBySearch: efid=" + efid + " ("+ oldTag + "," + oldPhoneNumber + ")"+ "==>" + " ("+ newTag + "," + newPhoneNumber + ")"+ " pin2=" + pin2); + + efid = updateEfForIccType(efid); + synchronized(mLock) { checkThread(); success = false; diff --git a/telephony/java/com/android/internal/telephony/RIL.java b/telephony/java/com/android/internal/telephony/RIL.java index 2833d56..d79a89e 100644 --- a/telephony/java/com/android/internal/telephony/RIL.java +++ b/telephony/java/com/android/internal/telephony/RIL.java @@ -3406,6 +3406,8 @@ public final class RIL extends BaseCommands implements CommandsInterface { RILRequest rr = RILRequest.obtain( RILConstants.RIL_REQUEST_QUERY_TTY_MODE, response); + if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); + send(rr); } @@ -3419,6 +3421,9 @@ public final class RIL extends BaseCommands implements CommandsInterface { rr.mp.writeInt(1); rr.mp.writeInt(ttyMode); + if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + + " : " + ttyMode); + send(rr); } diff --git a/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java b/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java index d99a348..30f38bd 100644 --- a/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java +++ b/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java @@ -560,6 +560,13 @@ public final class SIMRecords extends IccRecords { break; case EVENT_GET_CPHS_MAILBOX_DONE: case EVENT_GET_MBDN_DONE: + //Resetting the voice mail number and voice mail tag to null + //as these should be updated from the data read from EF_MBDN. + //If they are not reset, incase of invalid data/exception these + //variables are retaining their previous values and are + //causing invalid voice mailbox info display to user. + voiceMailNum = null; + voiceMailTag = null; isRecordLoadResponse = true; ar = (AsyncResult)msg.obj; diff --git a/telephony/java/com/android/internal/telephony/gsm/UsimPhoneBookManager.java b/telephony/java/com/android/internal/telephony/gsm/UsimPhoneBookManager.java index 41e527c..b642541 100644..100755 --- a/telephony/java/com/android/internal/telephony/gsm/UsimPhoneBookManager.java +++ b/telephony/java/com/android/internal/telephony/gsm/UsimPhoneBookManager.java @@ -53,6 +53,7 @@ public class UsimPhoneBookManager extends Handler implements IccConstants { private ArrayList<byte[]> mIapFileRecord; private ArrayList<byte[]> mEmailFileRecord; private Map<Integer, ArrayList<String>> mEmailsForAdnRec; + private boolean mRefreshCache = false; private static final int EVENT_PBR_LOAD_DONE = 1; private static final int EVENT_USIM_ADN_LOAD_DONE = 2; @@ -91,11 +92,19 @@ public class UsimPhoneBookManager extends Handler implements IccConstants { mEmailFileRecord = null; mPbrFile = null; mIsPbrPresent = true; + mRefreshCache = false; } public ArrayList<AdnRecord> loadEfFilesFromUsim() { synchronized (mLock) { - if (!mPhoneBookRecords.isEmpty()) return mPhoneBookRecords; + if (!mPhoneBookRecords.isEmpty()) { + if (mRefreshCache) { + mRefreshCache = false; + refreshCache(); + } + return mPhoneBookRecords; + } + if (!mIsPbrPresent) return null; // Check if the PBR file is present in the cache, if not read it @@ -116,6 +125,20 @@ public class UsimPhoneBookManager extends Handler implements IccConstants { return mPhoneBookRecords; } + private void refreshCache() { + if (mPbrFile == null) return; + mPhoneBookRecords.clear(); + + int numRecs = mPbrFile.mFileIds.size(); + for (int i = 0; i < numRecs; i++) { + readAdnFileAndWait(i); + } + } + + public void invalidateCache() { + mRefreshCache = true; + } + private void readPbrFileAndWait() { mPhone.getIccFileHandler().loadEFLinearFixedAll(EF_PBR, obtainMessage(EVENT_PBR_LOAD_DONE)); try { |