diff options
| -rw-r--r-- | api/current.txt | 1 | ||||
| -rw-r--r-- | core/java/android/app/ActivityManager.java | 10 | ||||
| -rw-r--r-- | core/java/android/app/ActivityThread.java | 11 | ||||
| -rw-r--r-- | tests/CantSaveState1/Android.mk | 10 | ||||
| -rw-r--r-- | tests/CantSaveState1/AndroidManifest.xml | 27 | ||||
| -rw-r--r-- | tests/CantSaveState1/res/layout/cant_save_1_activity.xml | 31 | ||||
| -rw-r--r-- | tests/CantSaveState1/src/com/android/test/cantsavestate2/CantSave1Activity.java | 28 | ||||
| -rw-r--r-- | tests/CantSaveState2/Android.mk | 10 | ||||
| -rw-r--r-- | tests/CantSaveState2/AndroidManifest.xml | 27 | ||||
| -rw-r--r-- | tests/CantSaveState2/res/layout/cant_save_2_activity.xml | 31 | ||||
| -rw-r--r-- | tests/CantSaveState2/src/com/android/test/cantsavestate2/CantSave2Activity.java | 28 |
11 files changed, 16 insertions, 198 deletions
diff --git a/api/current.txt b/api/current.txt index f56f1a16b966..0d55ddf136ba 100644 --- a/api/current.txt +++ b/api/current.txt @@ -3952,6 +3952,7 @@ package android.app { field public static final android.os.Parcelable.Creator<android.app.ActivityManager.RunningAppProcessInfo> CREATOR; field public static final deprecated int IMPORTANCE_BACKGROUND = 400; // 0x190 field public static final int IMPORTANCE_CACHED = 400; // 0x190 + field public static final int IMPORTANCE_CANT_SAVE_STATE = 270; // 0x10e field public static final deprecated int IMPORTANCE_EMPTY = 500; // 0x1f4 field public static final int IMPORTANCE_FOREGROUND = 100; // 0x64 field public static final int IMPORTANCE_FOREGROUND_SERVICE = 125; // 0x7d diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index 924137838ad4..142630e0d507 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -2944,10 +2944,10 @@ public class ActivityManager { /** * Constant for {@link #importance}: This process is running an * application that can not save its state, and thus can't be killed - * while in the background. - * @hide + * while in the background. This will be used with apps that have + * {@link android.R.attr#cantSaveState} set on their application tag. */ - public static final int IMPORTANCE_CANT_SAVE_STATE= 270; + public static final int IMPORTANCE_CANT_SAVE_STATE = 270; /** * Constant for {@link #importance}: This process is contains services @@ -2995,7 +2995,7 @@ public class ActivityManager { return IMPORTANCE_CACHED; } else if (procState >= PROCESS_STATE_SERVICE) { return IMPORTANCE_SERVICE; - } else if (procState > PROCESS_STATE_HEAVY_WEIGHT) { + } else if (procState == PROCESS_STATE_HEAVY_WEIGHT) { return IMPORTANCE_CANT_SAVE_STATE; } else if (procState >= PROCESS_STATE_TRANSIENT_BACKGROUND) { return IMPORTANCE_PERCEPTIBLE; @@ -3051,7 +3051,7 @@ public class ActivityManager { return PROCESS_STATE_HOME; } else if (importance >= IMPORTANCE_SERVICE) { return PROCESS_STATE_SERVICE; - } else if (importance > IMPORTANCE_CANT_SAVE_STATE) { + } else if (importance == IMPORTANCE_CANT_SAVE_STATE) { return PROCESS_STATE_HEAVY_WEIGHT; } else if (importance >= IMPORTANCE_PERCEPTIBLE) { return PROCESS_STATE_TRANSIENT_BACKGROUND; diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 20213199f53b..648b6fa33931 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -5605,7 +5605,16 @@ public final class ActivityThread extends ClientTransactionHandler { // Continue loading instrumentation. if (ii != null) { - final ApplicationInfo instrApp = new ApplicationInfo(); + ApplicationInfo instrApp; + try { + instrApp = getPackageManager().getApplicationInfo(ii.packageName, 0, + UserHandle.myUserId()); + } catch (RemoteException e) { + instrApp = null; + } + if (instrApp == null) { + instrApp = new ApplicationInfo(); + } ii.copyTo(instrApp); instrApp.initForUser(UserHandle.myUserId()); final LoadedApk pi = getPackageInfo(instrApp, data.compatInfo, diff --git a/tests/CantSaveState1/Android.mk b/tests/CantSaveState1/Android.mk deleted file mode 100644 index 6e9db6e867e5..000000000000 --- a/tests/CantSaveState1/Android.mk +++ /dev/null @@ -1,10 +0,0 @@ -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := tests - -LOCAL_SRC_FILES := $(call all-subdir-java-files) - -LOCAL_PACKAGE_NAME := CantSaveState1 - -include $(BUILD_PACKAGE) diff --git a/tests/CantSaveState1/AndroidManifest.xml b/tests/CantSaveState1/AndroidManifest.xml deleted file mode 100644 index fadcaebdeddb..000000000000 --- a/tests/CantSaveState1/AndroidManifest.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2017 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.test.cantsavestate1"> - <application android:label="Can't Save 1" android:cantSaveState="true"> - <activity android:name="CantSave1Activity"> - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - </application> -</manifest> diff --git a/tests/CantSaveState1/res/layout/cant_save_1_activity.xml b/tests/CantSaveState1/res/layout/cant_save_1_activity.xml deleted file mode 100644 index c5bf657c7fb1..000000000000 --- a/tests/CantSaveState1/res/layout/cant_save_1_activity.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2017 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" -> - - <TextView - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="25dp" - android:textAppearance="?android:attr/textAppearanceLarge" - android:text="This app #1 can't save its state" - /> - -</LinearLayout> diff --git a/tests/CantSaveState1/src/com/android/test/cantsavestate2/CantSave1Activity.java b/tests/CantSaveState1/src/com/android/test/cantsavestate2/CantSave1Activity.java deleted file mode 100644 index 8879ed03e8b4..000000000000 --- a/tests/CantSaveState1/src/com/android/test/cantsavestate2/CantSave1Activity.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.test.cantsavestate1; - -import android.app.Activity; -import android.os.Bundle; - -public class CantSave1Activity extends Activity { - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.cant_save_1_activity); - } -} diff --git a/tests/CantSaveState2/Android.mk b/tests/CantSaveState2/Android.mk deleted file mode 100644 index add9214e38c7..000000000000 --- a/tests/CantSaveState2/Android.mk +++ /dev/null @@ -1,10 +0,0 @@ -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := tests - -LOCAL_SRC_FILES := $(call all-subdir-java-files) - -LOCAL_PACKAGE_NAME := CantSaveState2 - -include $(BUILD_PACKAGE) diff --git a/tests/CantSaveState2/AndroidManifest.xml b/tests/CantSaveState2/AndroidManifest.xml deleted file mode 100644 index 8f4f01d19fc7..000000000000 --- a/tests/CantSaveState2/AndroidManifest.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2017 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.test.cantsavestate2"> - <application android:label="Can't Save 2" android:cantSaveState="true"> - <activity android:name="CantSave2Activity"> - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - </application> -</manifest> diff --git a/tests/CantSaveState2/res/layout/cant_save_2_activity.xml b/tests/CantSaveState2/res/layout/cant_save_2_activity.xml deleted file mode 100644 index c5b8e3d8bcd3..000000000000 --- a/tests/CantSaveState2/res/layout/cant_save_2_activity.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2017 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" -> - - <TextView - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="25dp" - android:textAppearance="?android:attr/textAppearanceLarge" - android:text="This app #2 can't save its state" - /> - -</LinearLayout> diff --git a/tests/CantSaveState2/src/com/android/test/cantsavestate2/CantSave2Activity.java b/tests/CantSaveState2/src/com/android/test/cantsavestate2/CantSave2Activity.java deleted file mode 100644 index 3ce63c77a881..000000000000 --- a/tests/CantSaveState2/src/com/android/test/cantsavestate2/CantSave2Activity.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.test.cantsavestate2; - -import android.app.Activity; -import android.os.Bundle; - -public class CantSave2Activity extends Activity { - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.cant_save_2_activity); - } -} |