summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Android.bp3
-rwxr-xr-xapi/current.txt30
-rw-r--r--cmds/statsd/src/atoms.proto1
-rw-r--r--cmds/statsd/src/external/StatsPullerManager.cpp3
-rw-r--r--cmds/statsd/src/packages/UidMap.cpp3
-rw-r--r--core/java/android/app/ActivityManagerInternal.java5
-rw-r--r--core/java/android/hardware/biometrics/BiometricAuthenticator.java4
-rw-r--r--core/java/android/hardware/face/FaceManager.java1
-rw-r--r--core/java/android/hardware/fingerprint/FingerprintManager.java8
-rw-r--r--core/java/com/android/internal/app/ResolverActivity.java7
-rwxr-xr-xcore/jni/android/graphics/Bitmap.cpp5
-rw-r--r--core/res/res/values-night/values.xml2
-rw-r--r--core/tests/coretests/AndroidManifest.xml1
-rw-r--r--core/tests/coretests/src/android/os/PowerManagerTest.java21
-rw-r--r--core/tests/coretests/src/android/view/inputmethod/InputMethodInfoTest.java4
-rw-r--r--packages/SystemUI/docs/plugins.md2
-rw-r--r--packages/SystemUI/res/drawable/ic_lock.xml26
-rw-r--r--packages/SystemUI/res/drawable/ic_lock_24dp.xml25
-rw-r--r--packages/SystemUI/res/drawable/ic_lock_open.xml26
-rw-r--r--packages/SystemUI/res/layout/keyguard_bottom_area.xml2
-rw-r--r--packages/SystemUI/res/values/dimens.xml4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/KeyguardAffordanceView.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java1
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java11
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java91
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/TrustDrawable.java290
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/doze/DozeConfigurationTest.java6
-rw-r--r--services/autofill/java/com/android/server/autofill/Session.java7
-rw-r--r--services/core/java/com/android/server/IpSecService.java35
-rw-r--r--services/core/java/com/android/server/PinnerService.java5
-rw-r--r--services/core/java/com/android/server/am/ActivityManagerService.java162
-rw-r--r--services/core/java/com/android/server/am/ActivityStackSupervisor.java13
-rw-r--r--services/core/java/com/android/server/am/ActivityStartController.java6
-rw-r--r--services/core/java/com/android/server/am/ActivityStarter.java2
-rw-r--r--services/core/java/com/android/server/am/ActivityTaskManagerService.java191
-rw-r--r--services/core/java/com/android/server/am/RecentTasks.java2
-rw-r--r--services/core/java/com/android/server/am/UserController.java4
-rw-r--r--services/core/java/com/android/server/biometrics/AuthenticationClient.java1
-rw-r--r--services/core/java/com/android/server/biometrics/BiometricService.java12
-rw-r--r--services/core/java/com/android/server/biometrics/BiometricServiceBase.java3
-rw-r--r--services/core/java/com/android/server/biometrics/ClientMonitor.java6
-rw-r--r--services/core/java/com/android/server/power/PowerManagerService.java31
-rw-r--r--services/core/java/com/android/server/stats/StatsCompanionService.java30
-rw-r--r--services/core/java/com/android/server/wm/ActivityTaskManagerInternal.java7
-rwxr-xr-xservices/tests/runtests.py26
-rw-r--r--services/tests/servicestests/src/com/android/server/textservices/LocaleUtilsTest.java6
-rw-r--r--telephony/java/android/telephony/DisconnectCause.java31
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java62
-rw-r--r--telephony/java/android/telephony/emergency/EmergencyNumber.aidl19
-rw-r--r--telephony/java/android/telephony/emergency/EmergencyNumber.java374
-rw-r--r--telephony/java/android/telephony/ims/ImsCallSession.java17
-rwxr-xr-xtelephony/java/com/android/internal/telephony/IAns.aidl (renamed from telephony/java/com/android/internal/telephony/IAnas.aidl)10
-rw-r--r--tests/NativeProcessesMemoryTest/src/com/android/tests/nativeprocesses/NativeProcessesMemoryTest.java50
-rw-r--r--tests/net/java/com/android/server/IpSecServiceParameterizedTest.java156
55 files changed, 1089 insertions, 769 deletions
diff --git a/Android.bp b/Android.bp
index 9f93d399f074..13c6e858c377 100644
--- a/Android.bp
+++ b/Android.bp
@@ -561,7 +561,7 @@ java_defaults {
"telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl",
"telephony/java/com/android/internal/telephony/ISms.aidl",
"telephony/java/com/android/internal/telephony/ISub.aidl",
- "telephony/java/com/android/internal/telephony/IAnas.aidl",
+ "telephony/java/com/android/internal/telephony/IAns.aidl",
"telephony/java/com/android/internal/telephony/ITelephony.aidl",
"telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl",
"telephony/java/com/android/internal/telephony/IWapPushManager.aidl",
@@ -703,6 +703,7 @@ java_defaults {
"android.hardware.vibrator-V1.2-java",
"android.hardware.wifi-V1.0-java-constants",
"android.hardware.radio-V1.0-java",
+ "android.hardware.radio-V1.3-java",
"android.hardware.usb.gadget-V1.0-java",
],
diff --git a/api/current.txt b/api/current.txt
index 4c67bae139ff..373bc18f3cf5 100755
--- a/api/current.txt
+++ b/api/current.txt
@@ -43360,6 +43360,36 @@ package android.telephony.data {
}
+package android.telephony.emergency {
+
+ public final class EmergencyNumber implements android.os.Parcelable {
+ method public int describeContents();
+ method public java.lang.String getCountryIso();
+ method public int getEmergencyNumberSourceBitmask();
+ method public java.util.List<java.lang.Integer> getEmergencyNumberSources();
+ method public java.util.List<java.lang.Integer> getEmergencyServiceCategories();
+ method public int getEmergencyServiceCategoryBitmask();
+ method public java.lang.String getNumber();
+ method public boolean isFromSources(int);
+ method public boolean isInEmergencyServiceCategories(int);
+ method public void writeToParcel(android.os.Parcel, int);
+ field public static final android.os.Parcelable.Creator<android.telephony.emergency.EmergencyNumber> CREATOR;
+ field public static final int EMERGENCY_NUMBER_SOURCE_DEFAULT = 8; // 0x8
+ field public static final int EMERGENCY_NUMBER_SOURCE_MODEM_CONFIG = 4; // 0x4
+ field public static final int EMERGENCY_NUMBER_SOURCE_NETWORK_SIGNALING = 1; // 0x1
+ field public static final int EMERGENCY_NUMBER_SOURCE_SIM = 2; // 0x2
+ field public static final int EMERGENCY_SERVICE_CATEGORY_AIEC = 64; // 0x40
+ field public static final int EMERGENCY_SERVICE_CATEGORY_AMBULANCE = 2; // 0x2
+ field public static final int EMERGENCY_SERVICE_CATEGORY_FIRE_BRIGADE = 4; // 0x4
+ field public static final int EMERGENCY_SERVICE_CATEGORY_MARINE_GUARD = 8; // 0x8
+ field public static final int EMERGENCY_SERVICE_CATEGORY_MIEC = 32; // 0x20
+ field public static final int EMERGENCY_SERVICE_CATEGORY_MOUNTAIN_RESCUE = 16; // 0x10
+ field public static final int EMERGENCY_SERVICE_CATEGORY_POLICE = 1; // 0x1
+ field public static final int EMERGENCY_SERVICE_CATEGORY_UNSPECIFIED = 0; // 0x0
+ }
+
+}
+
package android.telephony.euicc {
public final class DownloadableSubscription implements android.os.Parcelable {
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto
index 8ab67e32cd59..9d83afdeb819 100644
--- a/cmds/statsd/src/atoms.proto
+++ b/cmds/statsd/src/atoms.proto
@@ -181,6 +181,7 @@ message Atom {
NumFingerprints num_fingerprints = 10031;
DiskIo disk_io = 10032;
PowerProfile power_profile = 10033;
+ ProcStats proc_stats_pkg_proc = 10034;
}
// DO NOT USE field numbers above 100,000 in AOSP.
diff --git a/cmds/statsd/src/external/StatsPullerManager.cpp b/cmds/statsd/src/external/StatsPullerManager.cpp
index cd215b4bd705..dab64cacb679 100644
--- a/cmds/statsd/src/external/StatsPullerManager.cpp
+++ b/cmds/statsd/src/external/StatsPullerManager.cpp
@@ -211,6 +211,9 @@ const std::map<int, PullAtomInfo> StatsPullerManager::kAllPullAtomInfo = {
// ProcStats.
{android::util::PROC_STATS,
{{}, {}, 1 * NS_PER_SEC, new StatsCompanionServicePuller(android::util::PROC_STATS)}},
+ // ProcStatsPkgProc.
+ {android::util::PROC_STATS_PKG_PROC,
+ {{}, {}, 1 * NS_PER_SEC, new StatsCompanionServicePuller(android::util::PROC_STATS_PKG_PROC)}},
// Disk I/O stats per uid.
{android::util::DISK_IO,
{{2,3,4,5,6,7,8,9,10,11},
diff --git a/cmds/statsd/src/packages/UidMap.cpp b/cmds/statsd/src/packages/UidMap.cpp
index 4325f0fd77bd..8b1f5cbba3cb 100644
--- a/cmds/statsd/src/packages/UidMap.cpp
+++ b/cmds/statsd/src/packages/UidMap.cpp
@@ -489,6 +489,9 @@ const std::map<string, uint32_t> UidMap::sAidToUidMapping = {{"AID_ROOT", 0},
{"AID_RESERVED_DISK", 1065},
{"AID_STATSD", 1066},
{"AID_INCIDENTD", 1067},
+ {"AID_SECURE_ELEMENT", 1068},
+ {"AID_LMKD", 1069},
+ {"AID_LLKD", 1070},
{"AID_SHELL", 2000},
{"AID_CACHE", 2001},
{"AID_DIAG", 2002}};
diff --git a/core/java/android/app/ActivityManagerInternal.java b/core/java/android/app/ActivityManagerInternal.java
index 76b90f5354b3..784ce04908fe 100644
--- a/core/java/android/app/ActivityManagerInternal.java
+++ b/core/java/android/app/ActivityManagerInternal.java
@@ -212,11 +212,6 @@ public abstract class ActivityManagerInternal {
*/
public abstract boolean shouldConfirmCredentials(int userId);
- /**
- * @return The intent used to launch the home activity.
- */
- public abstract Intent getHomeIntent();
-
public abstract int[] getCurrentProfileIds();
public abstract UserInfo getCurrentUser();
public abstract void ensureNotSpecialUser(int userId);
diff --git a/core/java/android/hardware/biometrics/BiometricAuthenticator.java b/core/java/android/hardware/biometrics/BiometricAuthenticator.java
index c604ff167636..1734b41675e4 100644
--- a/core/java/android/hardware/biometrics/BiometricAuthenticator.java
+++ b/core/java/android/hardware/biometrics/BiometricAuthenticator.java
@@ -201,6 +201,10 @@ public interface BiometricAuthenticator {
throw new UnsupportedOperationException("Stub!");
}
+ default boolean hasEnrolledTemplates(int userId) {
+ throw new UnsupportedOperationException("Stub!");
+ }
+
/**
* This call warms up the hardware and starts scanning for valid biometrics. It terminates
* when {@link AuthenticationCallback#onAuthenticationError(int,
diff --git a/core/java/android/hardware/face/FaceManager.java b/core/java/android/hardware/face/FaceManager.java
index 873a24a3b53b..7aec43ed4ca2 100644
--- a/core/java/android/hardware/face/FaceManager.java
+++ b/core/java/android/hardware/face/FaceManager.java
@@ -408,6 +408,7 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
@RequiresPermission(allOf = {
USE_BIOMETRIC_INTERNAL,
INTERACT_ACROSS_USERS})
+ @Override
public boolean hasEnrolledTemplates(int userId) {
if (mService != null) {
try {
diff --git a/core/java/android/hardware/fingerprint/FingerprintManager.java b/core/java/android/hardware/fingerprint/FingerprintManager.java
index a4f3ce1b9cce..bf2280d5c39a 100644
--- a/core/java/android/hardware/fingerprint/FingerprintManager.java
+++ b/core/java/android/hardware/fingerprint/FingerprintManager.java
@@ -637,6 +637,14 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
}
/**
+ * @hide
+ */
+ @Override
+ public boolean hasEnrolledTemplates(int userId) {
+ return hasEnrolledFingerprints(userId);
+ }
+
+ /**
* Determine if there is at least one fingerprint enrolled.
*
* @return true if at least one fingerprint is enrolled, false otherwise
diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java
index 0a812c68854f..fd3891778663 100644
--- a/core/java/com/android/internal/app/ResolverActivity.java
+++ b/core/java/com/android/internal/app/ResolverActivity.java
@@ -16,6 +16,8 @@
package com.android.internal.app;
+import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
+
import android.annotation.Nullable;
import android.annotation.StringRes;
import android.annotation.UiThread;
@@ -66,6 +68,7 @@ import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
+
import com.android.internal.R;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.content.PackageMonitor;
@@ -81,8 +84,6 @@ import java.util.List;
import java.util.Objects;
import java.util.Set;
-import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
-
/**
* This activity is displayed when the system attempts to start an Intent for
* which there is more than one matching activity, allowing the user to decide
@@ -288,6 +289,7 @@ public class ResolverActivity extends Activity {
mTitle = title;
mDefaultTitleResId = defaultTitleRes;
+ mIconFactory = IconDrawableFactory.newInstance(this, true);
if (configureContentView(mIntents, initialIntents, rList)) {
return;
}
@@ -335,7 +337,6 @@ public class ResolverActivity extends Activity {
: MetricsProto.MetricsEvent.ACTION_SHOW_APP_DISAMBIG_NONE_FEATURED,
intent.getAction() + ":" + intent.getType() + ":"
+ (categories != null ? Arrays.toString(categories.toArray()) : ""));
- mIconFactory = IconDrawableFactory.newInstance(this, true);
}
@Override
diff --git a/core/jni/android/graphics/Bitmap.cpp b/core/jni/android/graphics/Bitmap.cpp
index 644a9746cf2a..263596954954 100755
--- a/core/jni/android/graphics/Bitmap.cpp
+++ b/core/jni/android/graphics/Bitmap.cpp
@@ -7,14 +7,9 @@
#include "SkImageEncoder.h"
#include "SkImageInfo.h"
#include "SkColor.h"
-#include "SkColorPriv.h"
#include "SkColorSpace.h"
-#include "SkHalf.h"
#include "SkMatrix44.h"
-#include "SkPM4f.h"
-#include "SkPM4fPriv.h"
#include "GraphicsJNI.h"
-#include "SkUnPreMultiply.h"
#include "SkStream.h"
#include <binder/Parcel.h>
diff --git a/core/res/res/values-night/values.xml b/core/res/res/values-night/values.xml
index a2ad3b90e464..9de8842ae5da 100644
--- a/core/res/res/values-night/values.xml
+++ b/core/res/res/values-night/values.xml
@@ -20,7 +20,7 @@
<!-- Color palette -->
<item name="colorPrimaryDark">@color/primary_dark_device_default_settings</item>
<item name="colorSecondary">@color/secondary_device_default_settings</item>
- <item name="colorAccent">@color/accent_device_default_dark</item>
+ <item name="colorAccent">@color/white</item>
<item name="colorError">@color/error_color_device_default_dark</item>
<item name="colorControlNormal">?attr/textColorPrimary</item>
<item name="alertDialogTheme">@style/Theme.DeviceDefault.Dialog.Alert</item>
diff --git a/core/tests/coretests/AndroidManifest.xml b/core/tests/coretests/AndroidManifest.xml
index d704957a7666..f60d8d0adcdd 100644
--- a/core/tests/coretests/AndroidManifest.xml
+++ b/core/tests/coretests/AndroidManifest.xml
@@ -61,6 +61,7 @@
<uses-permission android:name="android.permission.READ_LOGS"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_SMS"/>
+ <uses-permission android:name="android.permission.UPDATE_DEVICE_STATS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
diff --git a/core/tests/coretests/src/android/os/PowerManagerTest.java b/core/tests/coretests/src/android/os/PowerManagerTest.java
index 0d250b825d97..da17b56bc0fa 100644
--- a/core/tests/coretests/src/android/os/PowerManagerTest.java
+++ b/core/tests/coretests/src/android/os/PowerManagerTest.java
@@ -64,7 +64,7 @@ public class PowerManagerTest extends AndroidTestCase {
// TODO: Some sort of functional test (maybe not in the unit test here?)
// that confirms that things are really happening e.g. screen power, keyboard power.
-}
+ }
/**
* Confirm that we can't create dysfunctional wakelocks.
@@ -85,6 +85,25 @@ public class PowerManagerTest extends AndroidTestCase {
}
/**
+ * Ensure that we can have work sources with work chains when uid is not set directly on work
+ * source, and that this doesn't crash system server.
+ *
+ * @throws Exception
+ */
+ @SmallTest
+ public void testWakeLockWithWorkChains() throws Exception {
+ PowerManager.WakeLock wakeLock = mPm.newWakeLock(
+ PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP,
+ "TEST_LOCK");
+ WorkSource workSource = new WorkSource();
+ WorkSource.WorkChain workChain = workSource.createWorkChain();
+ workChain.addNode(1000, "test");
+ wakeLock.setWorkSource(workSource);
+
+ doTestWakeLock(wakeLock);
+ }
+
+ /**
* Apply a few tests to a wakelock to make sure it's healthy.
*
* @param wl The wakelock to be tested.
diff --git a/core/tests/coretests/src/android/view/inputmethod/InputMethodInfoTest.java b/core/tests/coretests/src/android/view/inputmethod/InputMethodInfoTest.java
index 9edbf3efeebb..1b00e0939688 100644
--- a/core/tests/coretests/src/android/view/inputmethod/InputMethodInfoTest.java
+++ b/core/tests/coretests/src/android/view/inputmethod/InputMethodInfoTest.java
@@ -26,8 +26,8 @@ import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
import android.os.Bundle;
import android.os.Parcel;
-import android.support.test.filters.LargeTest;
import android.support.test.InstrumentationRegistry;
+import android.support.test.filters.SmallTest;
import android.support.test.runner.AndroidJUnit4;
import com.android.frameworks.coretests.R;
@@ -35,7 +35,7 @@ import com.android.frameworks.coretests.R;
import org.junit.Test;
import org.junit.runner.RunWith;
-@LargeTest
+@SmallTest
@RunWith(AndroidJUnit4.class)
public class InputMethodInfoTest {
diff --git a/packages/SystemUI/docs/plugins.md b/packages/SystemUI/docs/plugins.md
index ed91f3daf869..689200577aad 100644
--- a/packages/SystemUI/docs/plugins.md
+++ b/packages/SystemUI/docs/plugins.md
@@ -73,7 +73,7 @@ When compiling plugins there are a couple vital pieces required.
1. They must be signed with the platform cert
2. They must include SystemUIPluginLib in LOCAL_JAVA_LIBRARIES (NOT LOCAL_STATIC_JAVA_LIBRARIES)
-Basically just copy the [example file](/packages/SystemUI/plugin/ExamplePlugin/Android.mk).
+Basically just copy the [example blueprint file](/packages/SystemUI/plugin/ExamplePlugin/Android.bp).
To declare a plugin, you add a service to your manifest.  Add an intent filter to match the action for the plugin, and set the name to point at the class that implements the plugin interface.
diff --git a/packages/SystemUI/res/drawable/ic_lock.xml b/packages/SystemUI/res/drawable/ic_lock.xml
new file mode 100644
index 000000000000..3fb8c8df8035
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_lock.xml
@@ -0,0 +1,26 @@
+<!--
+ ~ Copyright (C) 2018 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
+ -->
+
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="32dp"
+ android:height="32dp"
+ android:viewportWidth="32.0"
+ android:viewportHeight="32.0">
+ <path
+ android:pathData="M20.25,6.89C20.25,4.62 18.36,2.75 16,2.75C13.64,2.75 11.75,4.62 11.75,6.89V11.25H20.25V6.89ZM21.75,11.25V6.89C21.75,3.76 19.16,1.25 16,1.25C12.84,1.25 10.25,3.76 10.25,6.89V11.25H10C8.48,11.25 7.25,12.48 7.25,14V26C7.25,27.52 8.48,28.75 10,28.75H22C23.52,28.75 24.75,27.52 24.75,26V14C24.75,12.48 23.52,11.25 22,11.25H21.75ZM10,12.75C9.31,12.75 8.75,13.31 8.75,14V26C8.75,26.69 9.31,27.25 10,27.25H22C22.69,27.25 23.25,26.69 23.25,26V14C23.25,13.31 22.69,12.75 22,12.75H10ZM18,20C18,21.1 17.1,22 16,22C14.9,22 14,21.1 14,20C14,18.9 14.9,18 16,18C17.1,18 18,18.9 18,20Z"
+ android:fillType="evenOdd"
+ android:fillColor="?attr/wallpaperTextColor"/>
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_lock_24dp.xml b/packages/SystemUI/res/drawable/ic_lock_24dp.xml
deleted file mode 100644
index bf0dc95a8e56..000000000000
--- a/packages/SystemUI/res/drawable/ic_lock_24dp.xml
+++ /dev/null
@@ -1,25 +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.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24.0dp"
- android:height="24.0dp"
- android:viewportWidth="24.0"
- android:viewportHeight="24.0">
-
- <path
- android:fillColor="?attr/wallpaperTextColor"
- android:pathData="M18.0,8.0l-1.0,0.0L17.0,6.0c0.0,-2.8 -2.2,-5.0 -5.0,-5.0C9.2,1.0 7.0,3.2 7.0,6.0l0.0,2.0L6.0,8.0c-1.1,0.0 -2.0,0.9 -2.0,2.0l0.0,10.0c0.0,1.1 0.9,2.0 2.0,2.0l12.0,0.0c1.1,0.0 2.0,-0.9 2.0,-2.0L20.0,10.0C20.0,8.9 19.1,8.0 18.0,8.0zM12.0,17.0c-1.1,0.0 -2.0,-0.9 -2.0,-2.0s0.9,-2.0 2.0,-2.0c1.1,0.0 2.0,0.9 2.0,2.0S13.1,17.0 12.0,17.0zM15.1,8.0L8.9,8.0L8.9,6.0c0.0,-1.7 1.4,-3.1 3.1,-3.1c1.7,0.0 3.1,1.4 3.1,3.1L15.1,8.0z"/>
-</vector>
diff --git a/packages/SystemUI/res/drawable/ic_lock_open.xml b/packages/SystemUI/res/drawable/ic_lock_open.xml
new file mode 100644
index 000000000000..12a811cb847e
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_lock_open.xml
@@ -0,0 +1,26 @@
+<!--
+ ~ Copyright (C) 2018 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
+ -->
+
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="32dp"
+ android:height="32dp"
+ android:viewportWidth="32.0"
+ android:viewportHeight="32.0">
+ <path
+ android:pathData="M21.75,6.89C21.75,4.62 23.64,2.75 26,2.75C28.36,2.75 30.25,4.62 30.25,6.89V12H31.75V6.89C31.75,3.76 29.16,1.25 26,1.25C22.84,1.25 20.25,3.76 20.25,6.89V11.25H10C8.48,11.25 7.25,12.48 7.25,14V26C7.25,27.52 8.48,28.75 10,28.75H22C23.52,28.75 24.75,27.52 24.75,26V14C24.75,12.48 23.52,11.25 22,11.25H21.75V6.89ZM10,12.75C9.31,12.75 8.75,13.31 8.75,14V26C8.75,26.69 9.31,27.25 10,27.25H22C22.69,27.25 23.25,26.69 23.25,26V14C23.25,13.31 22.69,12.75 22,12.75H10ZM18,20C18,21.1 17.1,22 16,22C14.9,22 14,21.1 14,20C14,18.9 14.9,18 16,18C17.1,18 18,18.9 18,20Z"
+ android:fillType="evenOdd"
+ android:fillColor="?attr/wallpaperTextColor"/>
+</vector>
diff --git a/packages/SystemUI/res/layout/keyguard_bottom_area.xml b/packages/SystemUI/res/layout/keyguard_bottom_area.xml
index d0d379c286bd..96a1babcd550 100644
--- a/packages/SystemUI/res/layout/keyguard_bottom_area.xml
+++ b/packages/SystemUI/res/layout/keyguard_bottom_area.xml
@@ -88,7 +88,7 @@
android:layout_width="@dimen/keyguard_affordance_width"
android:layout_height="@dimen/keyguard_affordance_height"
android:layout_gravity="bottom|center_horizontal"
- android:src="@drawable/ic_lock_24dp"
+ android:src="@drawable/ic_lock"
android:contentDescription="@string/accessibility_unlock_button"
android:scaleType="center" />
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 7c355c9b05e8..ab7dec9bbb4d 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -645,10 +645,6 @@
<dimen name="keyguard_affordance_height">56dp</dimen>
<dimen name="keyguard_affordance_width">56dp</dimen>
- <!-- The width/height of the phone/camera/unlock icon drawable on keyguard. -->
- <dimen name="keyguard_affordance_icon_height">24dp</dimen>
- <dimen name="keyguard_affordance_icon_width">24dp</dimen>
-
<dimen name="keyguard_indication_margin_bottom">65dp</dimen>
<!-- The text size for battery level -->
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardAffordanceView.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardAffordanceView.java
index e12b57444993..9d773edec551 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardAffordanceView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardAffordanceView.java
@@ -76,7 +76,7 @@ public class KeyguardAffordanceView extends ImageView {
private float mCircleStartRadius;
private float mMaxCircleSize;
private Animator mPreviewClipper;
- private float mRestingAlpha = KeyguardAffordanceHelper.SWIPE_RESTING_ALPHA_AMOUNT;
+ private float mRestingAlpha = 1f;
private boolean mSupportHardware;
private boolean mFinishing;
private boolean mLaunchingAffordance;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java
index e2f33198a0ed..49d421be3fc4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java
@@ -36,7 +36,6 @@ import com.android.systemui.statusbar.KeyguardAffordanceView;
*/
public class KeyguardAffordanceHelper {
- public static final float SWIPE_RESTING_ALPHA_AMOUNT = 0.5f;
public static final long HINT_PHASE1_DURATION = 200;
private static final long HINT_PHASE2_DURATION = 350;
private static final float BACKGROUND_RADIUS_SCALE_FACTOR = 0.25f;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
index f667726461f3..538a260b4b8e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
@@ -29,7 +29,6 @@ import android.app.ActivityManager;
import android.app.ActivityOptions;
import android.app.ActivityTaskManager;
import android.app.admin.DevicePolicyManager;
-import android.hardware.biometrics.BiometricSourceType;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
@@ -41,6 +40,7 @@ import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.Configuration;
import android.graphics.drawable.Drawable;
+import android.hardware.biometrics.BiometricSourceType;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.IBinder;
@@ -54,7 +54,6 @@ import android.telecom.TelecomManager;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
-import android.util.MathUtils;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
@@ -68,16 +67,14 @@ import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
-import com.android.systemui.EventLogTags;
import com.android.systemui.Dependency;
import com.android.systemui.Interpolators;
import com.android.systemui.R;
import com.android.systemui.assist.AssistManager;
+import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.IntentButtonProvider;
import com.android.systemui.plugins.IntentButtonProvider.IntentButton;
import com.android.systemui.plugins.IntentButtonProvider.IntentButton.IconState;
-import com.android.systemui.plugins.PluginListener;
-import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.KeyguardAffordanceView;
import com.android.systemui.statusbar.KeyguardIndicationController;
@@ -705,8 +702,6 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
startFinishDozeAnimationElement(mLeftAffordanceView, delay);
delay += DOZE_ANIMATION_STAGGER_DELAY;
}
- startFinishDozeAnimationElement(mLockIcon, delay);
- delay += DOZE_ANIMATION_STAGGER_DELAY;
if (mRightAffordanceView.getVisibility() == View.VISIBLE) {
startFinishDozeAnimationElement(mRightAffordanceView, delay);
}
@@ -823,10 +818,8 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
updateLeftAffordanceIcon();
if (dozing) {
- mLockIcon.setVisibility(INVISIBLE);
mOverlayContainer.setVisibility(INVISIBLE);
} else {
- mLockIcon.setVisibility(VISIBLE);
mOverlayContainer.setVisibility(VISIBLE);
if (animate) {
startFinishDozeAnimation();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
index 8928530c6c0e..2edc294084cd 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
@@ -51,7 +51,6 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
private boolean mScreenOn;
private boolean mLastScreenOn;
private Drawable mUserAvatarIcon;
- private TrustDrawable mTrustDrawable;
private final UnlockMethodCache mUnlockMethodCache;
private AccessibilityController mAccessibilityController;
private boolean mHasFingerPrintIcon;
@@ -62,28 +61,10 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
public LockIcon(Context context, AttributeSet attrs) {
super(context, attrs);
- mTrustDrawable = new TrustDrawable(context);
- setBackground(mTrustDrawable);
mUnlockMethodCache = UnlockMethodCache.getInstance(context);
}
@Override
- protected void onVisibilityChanged(View changedView, int visibility) {
- super.onVisibilityChanged(changedView, visibility);
- if (isShown()) {
- mTrustDrawable.start();
- } else {
- mTrustDrawable.stop();
- }
- }
-
- @Override
- protected void onDetachedFromWindow() {
- super.onDetachedFromWindow();
- mTrustDrawable.stop();
- }
-
- @Override
public void onUserInfoChanged(String name, Drawable picture, String userAccount) {
mUserAvatarIcon = picture;
update();
@@ -110,9 +91,6 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
final int density = newConfig.densityDpi;
if (density != mDensity) {
mDensity = density;
- mTrustDrawable.stop();
- mTrustDrawable = new TrustDrawable(getContext());
- setBackground(mTrustDrawable);
update();
}
}
@@ -122,18 +100,9 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
}
public void update(boolean force) {
- boolean visible = isShown()
- && KeyguardUpdateMonitor.getInstance(mContext).isDeviceInteractive();
- if (visible) {
- mTrustDrawable.start();
- } else {
- mTrustDrawable.stop();
- }
int state = getState();
boolean anyFingerprintIcon = state == STATE_FINGERPRINT || state == STATE_FINGERPRINT_ERROR;
mHasFaceUnlockIcon = state == STATE_FACE_UNLOCK;
- boolean useAdditionalPadding = anyFingerprintIcon;
- boolean trustHidden = anyFingerprintIcon;
if (state != mLastState || mDeviceInteractive != mLastDeviceInteractive
|| mScreenOn != mLastScreenOn || force) {
int iconAnimRes =
@@ -142,16 +111,10 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
boolean isAnim = iconAnimRes != -1;
if (iconAnimRes == R.drawable.lockscreen_fingerprint_draw_off_animation) {
anyFingerprintIcon = true;
- useAdditionalPadding = true;
- trustHidden = true;
} else if (iconAnimRes == R.drawable.trusted_state_to_error_animation) {
anyFingerprintIcon = true;
- useAdditionalPadding = false;
- trustHidden = true;
} else if (iconAnimRes == R.drawable.error_to_trustedstate_animation) {
anyFingerprintIcon = true;
- useAdditionalPadding = false;
- trustHidden = false;
}
Drawable icon;
@@ -166,20 +129,6 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
final AnimatedVectorDrawable animation = icon instanceof AnimatedVectorDrawable
? (AnimatedVectorDrawable) icon
: null;
- int iconHeight = getResources().getDimensionPixelSize(
- R.dimen.keyguard_affordance_icon_height);
- int iconWidth = getResources().getDimensionPixelSize(
- R.dimen.keyguard_affordance_icon_width);
- if (!anyFingerprintIcon && (icon.getIntrinsicHeight() != iconHeight
- || icon.getIntrinsicWidth() != iconWidth)) {
- icon = new IntrinsicSizeDrawable(icon, iconWidth, iconHeight);
- }
- setPaddingRelative(0, 0, 0, useAdditionalPadding
- ? getResources().getDimensionPixelSize(
- R.dimen.fingerprint_icon_additional_padding)
- : 0);
- setRestingAlpha(
- anyFingerprintIcon ? 1f : KeyguardAffordanceHelper.SWIPE_RESTING_ALPHA_AMOUNT);
setImageDrawable(icon, false);
if (mHasFaceUnlockIcon) {
announceForAccessibility(getContext().getString(
@@ -204,9 +153,6 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
mLastScreenOn = mScreenOn;
}
- // Hide trust circle when fingerprint is running.
- boolean trustManaged = mUnlockMethodCache.isTrustManaged() && !trustHidden;
- mTrustDrawable.setTrustManaged(trustManaged);
updateClickability();
}
@@ -250,27 +196,21 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
private Drawable getIconForState(int state, boolean screenOn, boolean deviceInteractive) {
int iconRes;
switch (state) {
+ case STATE_FINGERPRINT:
case STATE_LOCKED:
- iconRes = R.drawable.ic_lock_24dp;
+ iconRes = R.drawable.ic_lock;
break;
case STATE_LOCK_OPEN:
if (mUnlockMethodCache.isTrustManaged() && mUnlockMethodCache.isTrusted()
&& mUserAvatarIcon != null) {
return mUserAvatarIcon;
} else {
- iconRes = R.drawable.ic_lock_open_24dp;
+ iconRes = R.drawable.ic_lock_open;
}
break;
case STATE_FACE_UNLOCK:
iconRes = R.drawable.ic_face_unlock;
break;
- case STATE_FINGERPRINT:
- // If screen is off and device asleep, use the draw on animation so the first frame
- // gets drawn.
- iconRes = screenOn && deviceInteractive
- ? R.drawable.ic_fingerprint
- : R.drawable.lockscreen_fingerprint_draw_on_animation;
- break;
case STATE_FINGERPRINT_ERROR:
iconRes = R.drawable.ic_fingerprint_error;
break;
@@ -319,29 +259,4 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
return STATE_LOCKED;
}
}
-
- /**
- * A wrapper around another Drawable that overrides the intrinsic size.
- */
- private static class IntrinsicSizeDrawable extends InsetDrawable {
-
- private final int mIntrinsicWidth;
- private final int mIntrinsicHeight;
-
- public IntrinsicSizeDrawable(Drawable drawable, int intrinsicWidth, int intrinsicHeight) {
- super(drawable, 0);
- mIntrinsicWidth = intrinsicWidth;
- mIntrinsicHeight = intrinsicHeight;
- }
-
- @Override
- public int getIntrinsicWidth() {
- return mIntrinsicWidth;
- }
-
- @Override
- public int getIntrinsicHeight() {
- return mIntrinsicHeight;
- }
- }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index 6ea4c92e4143..6d53cd373d05 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -124,8 +124,6 @@ public class NotificationPanelView extends PanelView implements
private static final int CAP_HEIGHT = 1456;
private static final int FONT_HEIGHT = 2163;
- private static final float LOCK_ICON_ACTIVE_SCALE = 1.2f;
-
static final String COUNTER_PANEL_OPEN = "panel_open";
static final String COUNTER_PANEL_OPEN_QS = "panel_open_qs";
private static final String COUNTER_PANEL_OPEN_PEEK = "panel_open_peek";
@@ -1784,13 +1782,9 @@ public class NotificationPanelView extends PanelView implements
KeyguardAffordanceView lockIcon = mKeyguardBottomArea.getLockIcon();
if (active && !mUnlockIconActive && mTracking) {
lockIcon.setImageAlpha(1.0f, true, 150, Interpolators.FAST_OUT_LINEAR_IN, null);
- lockIcon.setImageScale(LOCK_ICON_ACTIVE_SCALE, true, 150,
- Interpolators.FAST_OUT_LINEAR_IN);
} else if (!active && mUnlockIconActive && mTracking) {
lockIcon.setImageAlpha(lockIcon.getRestingAlpha(), true /* animate */,
150, Interpolators.FAST_OUT_LINEAR_IN, null);
- lockIcon.setImageScale(1.0f, true, 150,
- Interpolators.FAST_OUT_LINEAR_IN);
}
mUnlockIconActive = active;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/TrustDrawable.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/TrustDrawable.java
deleted file mode 100644
index aa60ec5208d8..000000000000
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/TrustDrawable.java
+++ /dev/null
@@ -1,290 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.systemui.statusbar.phone;
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.AnimatorSet;
-import android.animation.ValueAnimator;
-import android.content.Context;
-import android.content.res.Resources;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.ColorFilter;
-import android.graphics.Paint;
-import android.graphics.PixelFormat;
-import android.graphics.Rect;
-import android.graphics.drawable.Drawable;
-import android.view.animation.Interpolator;
-
-import com.android.settingslib.Utils;
-import com.android.systemui.Interpolators;
-import com.android.systemui.R;
-
-public class TrustDrawable extends Drawable {
-
- private static final long ENTERING_FROM_UNSET_START_DELAY = 200;
- private static final long VISIBLE_DURATION = 1000;
- private static final long EXIT_DURATION = 500;
- private static final long ENTER_DURATION = 500;
-
- private static final int ALPHA_VISIBLE_MIN = 0x26;
- private static final int ALPHA_VISIBLE_MAX = 0x4c;
-
- private static final int STATE_UNSET = -1;
- private static final int STATE_GONE = 0;
- private static final int STATE_ENTERING = 1;
- private static final int STATE_VISIBLE = 2;
- private static final int STATE_EXITING = 3;
-
- private int mAlpha;
- private boolean mAnimating;
-
- private int mCurAlpha;
- private float mCurInnerRadius;
- private Animator mCurAnimator;
- private int mState = STATE_UNSET;
- private Paint mPaint;
- private boolean mTrustManaged;
-
- private final float mInnerRadiusVisibleMin;
- private final float mInnerRadiusVisibleMax;
- private final float mInnerRadiusExit;
- private final float mInnerRadiusEnter;
- private final float mThickness;
-
- private final Animator mVisibleAnimator;
-
- public TrustDrawable(Context context) {
- Resources r = context.getResources();
- mInnerRadiusVisibleMin = r.getDimension(R.dimen.trust_circle_inner_radius_visible_min);
- mInnerRadiusVisibleMax = r.getDimension(R.dimen.trust_circle_inner_radius_visible_max);
- mInnerRadiusExit = r.getDimension(R.dimen.trust_circle_inner_radius_exit);
- mInnerRadiusEnter = r.getDimension(R.dimen.trust_circle_inner_radius_enter);
- mThickness = r.getDimension(R.dimen.trust_circle_thickness);
-
- mCurInnerRadius = mInnerRadiusEnter;
-
- mVisibleAnimator = makeVisibleAnimator();
-
- mPaint = new Paint();
- mPaint.setStyle(Paint.Style.STROKE);
- mPaint.setColor(Utils.getColorAttrDefaultColor(context, R.attr.wallpaperTextColor));
- mPaint.setAntiAlias(true);
- mPaint.setStrokeWidth(mThickness);
- }
-
- @Override
- public void draw(Canvas canvas) {
- int newAlpha = (mCurAlpha * mAlpha) / 256;
- if (newAlpha == 0) {
- return;
- }
- final Rect r = getBounds();
- mPaint.setAlpha(newAlpha);
- canvas.drawCircle(r.exactCenterX(), r.exactCenterY(), mCurInnerRadius, mPaint);
- }
-
- @Override
- public void setAlpha(int alpha) {
- mAlpha = alpha;
- }
-
- @Override
- public int getAlpha() {
- return mAlpha;
- }
-
- @Override
- public void setColorFilter(ColorFilter colorFilter) {
- throw new UnsupportedOperationException("not implemented");
- }
-
- @Override
- public int getOpacity() {
- return PixelFormat.TRANSLUCENT;
- }
-
- public void start() {
- if (!mAnimating) {
- mAnimating = true;
- updateState(true);
- invalidateSelf();
- }
- }
-
- public void stop() {
- if (mAnimating) {
- mAnimating = false;
- if (mCurAnimator != null) {
- mCurAnimator.cancel();
- mCurAnimator = null;
- }
- mState = STATE_UNSET;
- mCurAlpha = 0;
- mCurInnerRadius = mInnerRadiusEnter;
- invalidateSelf();
- }
- }
-
- public void setTrustManaged(boolean trustManaged) {
- if (trustManaged == mTrustManaged && mState != STATE_UNSET) return;
- mTrustManaged = trustManaged;
- updateState(true);
- }
-
- private void updateState(boolean allowTransientState) {
- if (!mAnimating) {
- return;
- }
-
- int nextState = mState;
- if (mState == STATE_UNSET) {
- nextState = mTrustManaged ? STATE_ENTERING : STATE_GONE;
- } else if (mState == STATE_GONE) {
- if (mTrustManaged) nextState = STATE_ENTERING;
- } else if (mState == STATE_ENTERING) {
- if (!mTrustManaged) nextState = STATE_EXITING;
- } else if (mState == STATE_VISIBLE) {
- if (!mTrustManaged) nextState = STATE_EXITING;
- } else if (mState == STATE_EXITING) {
- if (mTrustManaged) nextState = STATE_ENTERING;
- }
- if (!allowTransientState) {
- if (nextState == STATE_ENTERING) nextState = STATE_VISIBLE;
- if (nextState == STATE_EXITING) nextState = STATE_GONE;
- }
-
- if (nextState != mState) {
- if (mCurAnimator != null) {
- mCurAnimator.cancel();
- mCurAnimator = null;
- }
-
- if (nextState == STATE_GONE) {
- mCurAlpha = 0;
- mCurInnerRadius = mInnerRadiusEnter;
- } else if (nextState == STATE_ENTERING) {
- mCurAnimator = makeEnterAnimator(mCurInnerRadius, mCurAlpha);
- if (mState == STATE_UNSET) {
- mCurAnimator.setStartDelay(ENTERING_FROM_UNSET_START_DELAY);
- }
- } else if (nextState == STATE_VISIBLE) {
- mCurAlpha = ALPHA_VISIBLE_MAX;
- mCurInnerRadius = mInnerRadiusVisibleMax;
- mCurAnimator = mVisibleAnimator;
- } else if (nextState == STATE_EXITING) {
- mCurAnimator = makeExitAnimator(mCurInnerRadius, mCurAlpha);
- }
-
- mState = nextState;
- if (mCurAnimator != null) {
- mCurAnimator.start();
- }
- invalidateSelf();
- }
- }
-
- private Animator makeVisibleAnimator() {
- return makeAnimators(mInnerRadiusVisibleMax, mInnerRadiusVisibleMin,
- ALPHA_VISIBLE_MAX, ALPHA_VISIBLE_MIN, VISIBLE_DURATION,
- Interpolators.ACCELERATE_DECELERATE,
- true /* repeating */, false /* stateUpdateListener */);
- }
-
- private Animator makeEnterAnimator(float radius, int alpha) {
- return makeAnimators(radius, mInnerRadiusVisibleMax,
- alpha, ALPHA_VISIBLE_MAX, ENTER_DURATION, Interpolators.LINEAR_OUT_SLOW_IN,
- false /* repeating */, true /* stateUpdateListener */);
- }
-
- private Animator makeExitAnimator(float radius, int alpha) {
- return makeAnimators(radius, mInnerRadiusExit,
- alpha, 0, EXIT_DURATION, Interpolators.FAST_OUT_SLOW_IN,
- false /* repeating */, true /* stateUpdateListener */);
- }
-
- private Animator makeAnimators(float startRadius, float endRadius,
- int startAlpha, int endAlpha, long duration, Interpolator interpolator,
- boolean repeating, boolean stateUpdateListener) {
- ValueAnimator alphaAnimator = configureAnimator(
- ValueAnimator.ofInt(startAlpha, endAlpha),
- duration, mAlphaUpdateListener, interpolator, repeating);
- ValueAnimator sizeAnimator = configureAnimator(
- ValueAnimator.ofFloat(startRadius, endRadius),
- duration, mRadiusUpdateListener, interpolator, repeating);
-
- AnimatorSet set = new AnimatorSet();
- set.playTogether(alphaAnimator, sizeAnimator);
- if (stateUpdateListener) {
- set.addListener(new StateUpdateAnimatorListener());
- }
- return set;
- }
-
- private ValueAnimator configureAnimator(ValueAnimator animator, long duration,
- ValueAnimator.AnimatorUpdateListener updateListener, Interpolator interpolator,
- boolean repeating) {
- animator.setDuration(duration);
- animator.addUpdateListener(updateListener);
- animator.setInterpolator(interpolator);
- if (repeating) {
- animator.setRepeatCount(ValueAnimator.INFINITE);
- animator.setRepeatMode(ValueAnimator.REVERSE);
- }
- return animator;
- }
-
- private final ValueAnimator.AnimatorUpdateListener mAlphaUpdateListener =
- new ValueAnimator.AnimatorUpdateListener() {
- @Override
- public void onAnimationUpdate(ValueAnimator animation) {
- mCurAlpha = (int) animation.getAnimatedValue();
- invalidateSelf();
- }
- };
-
- private final ValueAnimator.AnimatorUpdateListener mRadiusUpdateListener =
- new ValueAnimator.AnimatorUpdateListener() {
- @Override
- public void onAnimationUpdate(ValueAnimator animation) {
- mCurInnerRadius = (float) animation.getAnimatedValue();
- invalidateSelf();
- }
- };
-
- private class StateUpdateAnimatorListener extends AnimatorListenerAdapter {
- boolean mCancelled;
-
- @Override
- public void onAnimationStart(Animator animation) {
- mCancelled = false;
- }
-
- @Override
- public void onAnimationCancel(Animator animation) {
- mCancelled = true;
- }
-
- @Override
- public void onAnimationEnd(Animator animation) {
- if (!mCancelled) {
- updateState(false);
- }
- }
- }
-}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeConfigurationTest.java b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeConfigurationTest.java
index bb67d6e03a9d..45342d4bc3a9 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeConfigurationTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeConfigurationTest.java
@@ -47,10 +47,10 @@ public class DozeConfigurationTest extends SysuiTestCase {
return;
}
- Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.DOZE_ALWAYS_ON,
- null);
+ Settings.Secure.putStringForUser(mContext.getContentResolver(),
+ Settings.Secure.DOZE_ALWAYS_ON, null, UserHandle.USER_CURRENT);
boolean defaultValue = mContext.getResources()
.getBoolean(com.android.internal.R.bool.config_dozeAlwaysOnEnabled);
- assertEquals(mDozeConfig.alwaysOnEnabled(UserHandle.USER_CURRENT), defaultValue);
+ assertEquals(defaultValue, mDozeConfig.alwaysOnEnabled(UserHandle.USER_CURRENT));
}
}
diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java
index cf323fbd24b7..c1b620c657b3 100644
--- a/services/autofill/java/com/android/server/autofill/Session.java
+++ b/services/autofill/java/com/android/server/autofill/Session.java
@@ -400,7 +400,9 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
@Nullable
private AutofillValue findValueLocked(@NonNull AutofillId autofillId) {
final AutofillValue value = findValueFromThisSessionOnlyLocked(autofillId);
- if (value != null) return value;
+ if (value != null) {
+ return getSanitizedValue(createSanitizers(getSaveInfoLocked()), autofillId, value);
+ }
// TODO(b/113281366): rather than explicitly look for previous session, it might be better
// to merge the sessions when created (see note on mergePreviousSessionLocked())
@@ -415,7 +417,8 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
final AutofillValue previousValue = previousSession
.findValueFromThisSessionOnlyLocked(autofillId);
if (previousValue != null) {
- return previousValue;
+ return getSanitizedValue(createSanitizers(previousSession.getSaveInfoLocked()),
+ autofillId, previousValue);
}
}
}
diff --git a/services/core/java/com/android/server/IpSecService.java b/services/core/java/com/android/server/IpSecService.java
index a69d41683c29..8c25917c7436 100644
--- a/services/core/java/com/android/server/IpSecService.java
+++ b/services/core/java/com/android/server/IpSecService.java
@@ -19,6 +19,8 @@ package com.android.server;
import static android.Manifest.permission.DUMP;
import static android.net.IpSecManager.INVALID_RESOURCE_ID;
import static android.system.OsConstants.AF_INET;
+import static android.system.OsConstants.AF_INET6;
+import static android.system.OsConstants.AF_UNSPEC;
import static android.system.OsConstants.EINVAL;
import static android.system.OsConstants.IPPROTO_UDP;
import static android.system.OsConstants.SOCK_DGRAM;
@@ -63,6 +65,8 @@ import com.android.internal.util.Preconditions;
import java.io.FileDescriptor;
import java.io.IOException;
import java.io.PrintWriter;
+import java.net.Inet4Address;
+import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
@@ -1426,6 +1430,17 @@ public class IpSecService extends IIpSecService.Stub {
+ "or Encryption algorithms");
}
+ private int getFamily(String inetAddress) {
+ int family = AF_UNSPEC;
+ InetAddress checkAddress = NetworkUtils.numericToInetAddress(inetAddress);
+ if (checkAddress instanceof Inet4Address) {
+ family = AF_INET;
+ } else if (checkAddress instanceof Inet6Address) {
+ family = AF_INET6;
+ }
+ return family;
+ }
+
/**
* Checks an IpSecConfig parcel to ensure that the contents are sane and throws an
* IllegalArgumentException if they are not.
@@ -1479,6 +1494,26 @@ public class IpSecService extends IIpSecService.Stub {
// Require a valid source address for all transforms.
checkInetAddress(config.getSourceAddress());
+ // Check to ensure source and destination have the same address family.
+ String sourceAddress = config.getSourceAddress();
+ String destinationAddress = config.getDestinationAddress();
+ int sourceFamily = getFamily(sourceAddress);
+ int destinationFamily = getFamily(destinationAddress);
+ if (sourceFamily != destinationFamily) {
+ throw new IllegalArgumentException(
+ "Source address ("
+ + sourceAddress
+ + ") and destination address ("
+ + destinationAddress
+ + ") have different address families.");
+ }
+
+ // Throw an error if UDP Encapsulation is not used in IPv4.
+ if (config.getEncapType() != IpSecTransform.ENCAP_NONE && sourceFamily != AF_INET) {
+ throw new IllegalArgumentException(
+ "UDP Encapsulation is not supported for this address family");
+ }
+
switch (config.getMode()) {
case IpSecTransform.MODE_TRANSPORT:
break;
diff --git a/services/core/java/com/android/server/PinnerService.java b/services/core/java/com/android/server/PinnerService.java
index 0deaee7f7878..526aebe2e3e3 100644
--- a/services/core/java/com/android/server/PinnerService.java
+++ b/services/core/java/com/android/server/PinnerService.java
@@ -59,6 +59,7 @@ import com.android.internal.os.BackgroundThread;
import com.android.internal.util.DumpUtils;
import com.android.internal.util.function.pooled.PooledLambda;
+import com.android.server.wm.ActivityTaskManagerInternal;
import dalvik.system.DexFile;
import dalvik.system.VMRuntime;
@@ -103,6 +104,7 @@ public final class PinnerService extends SystemService {
public @interface AppKey {}
private final Context mContext;
+ private final ActivityTaskManagerInternal mAtmInternal;
private final ActivityManagerInternal mAmInternal;
private final IActivityManager mAm;
private final UserManager mUserManager;
@@ -164,6 +166,7 @@ public final class PinnerService extends SystemService {
}
mPinnerHandler = new PinnerHandler(BackgroundThread.get().getLooper());
+ mAtmInternal = LocalServices.getService(ActivityTaskManagerInternal.class);
mAmInternal = LocalServices.getService(ActivityManagerInternal.class);
mAm = ActivityManager.getService();
@@ -380,7 +383,7 @@ public final class PinnerService extends SystemService {
}
private ApplicationInfo getHomeInfo(int userHandle) {
- Intent intent = mAmInternal.getHomeIntent();
+ Intent intent = mAtmInternal.getHomeIntent();
return getApplicationInfoForIntent(intent, userHandle, false);
}
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 9c96968e566f..14b5e42366fd 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -42,6 +42,7 @@ import static android.content.pm.PackageManager.MATCH_UNINSTALLED_PACKAGES;
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
import static android.net.NetworkPolicyManager.isProcStateAllowedWhileIdleOrPowerSaveMode;
import static android.net.NetworkPolicyManager.isProcStateAllowedWhileOnRestrictBackground;
+import static android.os.FactoryTest.FACTORY_TEST_OFF;
import static android.os.IServiceManager.DUMP_FLAG_PRIORITY_CRITICAL;
import static android.os.IServiceManager.DUMP_FLAG_PRIORITY_HIGH;
import static android.os.IServiceManager.DUMP_FLAG_PRIORITY_NORMAL;
@@ -1068,17 +1069,10 @@ public class ActivityManagerService extends IActivityManager.Stub
*/
final StringBuilder mStringBuilder = new StringBuilder(256);
- /**
- * Used to control how we initialize the service.
- */
- ComponentName mTopComponent;
- String mTopAction = Intent.ACTION_MAIN;
- String mTopData;
-
volatile boolean mProcessesReady = false;
volatile boolean mSystemReady = false;
volatile boolean mOnBattery = false;
- volatile int mFactoryTest;
+ final int mFactoryTest;
volatile boolean mBooting = false;
@GuardedBy("this") boolean mCallFinishBooting = false;
@@ -1411,7 +1405,6 @@ public class ActivityManagerService extends IActivityManager.Stub
static final int SHOW_ERROR_UI_MSG = 1;
static final int SHOW_NOT_RESPONDING_UI_MSG = 2;
- static final int SHOW_FACTORY_ERROR_UI_MSG = 3;
static final int UPDATE_CONFIGURATION_MSG = 4;
static final int GC_BACKGROUND_PROCESSES_MSG = 5;
static final int WAIT_FOR_DEBUGGER_UI_MSG = 6;
@@ -1472,8 +1465,6 @@ public class ActivityManagerService extends IActivityManager.Stub
PackageManagerInternal mPackageManagerInt;
- boolean mHasHeavyWeightFeature;
-
/**
* Whether to force background check on all apps (for battery saver) or not.
*/
@@ -1555,12 +1546,6 @@ public class ActivityManagerService extends IActivityManager.Stub
}
ensureBootCompleted();
} break;
- case SHOW_FACTORY_ERROR_UI_MSG: {
- Dialog d = new FactoryErrorDialog(
- mUiContext, msg.getData().getCharSequence("msg"));
- d.show();
- ensureBootCompleted();
- } break;
case WAIT_FOR_DEBUGGER_UI_MSG: {
synchronized (ActivityManagerService.this) {
ProcessRecord app = (ProcessRecord)msg.obj;
@@ -2331,6 +2316,7 @@ public class ActivityManagerService extends IActivityManager.Stub
mProcStartHandlerThread = null;
mProcStartHandler = null;
mHiddenApiBlacklist = null;
+ mFactoryTest = FACTORY_TEST_OFF;
}
// Note: This method is invoked on the main thread but may need to attach various
@@ -3345,16 +3331,8 @@ public class ActivityManagerService extends IActivityManager.Stub
if (gids[1] == UserHandle.ERR_GID) gids[1] = gids[2];
}
checkTime(startTime, "startProcess: building args");
- if (mFactoryTest != FactoryTest.FACTORY_TEST_OFF) {
- if (mFactoryTest == FactoryTest.FACTORY_TEST_LOW_LEVEL
- && mTopComponent != null
- && app.processName.equals(mTopComponent.getPackageName())) {
- uid = 0;
- }
- if (mFactoryTest == FactoryTest.FACTORY_TEST_HIGH_LEVEL
- && (app.info.flags&ApplicationInfo.FLAG_FACTORY_TEST) != 0) {
- uid = 0;
- }
+ if (mAtmInternal.isFactoryTestProcess(app.getWindowProcessController())) {
+ uid = 0;
}
int runtimeFlags = 0;
if ((app.info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
@@ -3715,82 +3693,6 @@ public class ActivityManagerService extends IActivityManager.Stub
}
}
- Intent getHomeIntent() {
- Intent intent = new Intent(mTopAction, mTopData != null ? Uri.parse(mTopData) : null);
- intent.setComponent(mTopComponent);
- intent.addFlags(Intent.FLAG_DEBUG_TRIAGED_MISSING);
- if (mFactoryTest != FactoryTest.FACTORY_TEST_LOW_LEVEL) {
- intent.addCategory(Intent.CATEGORY_HOME);
- }
- return intent;
- }
-
- boolean startHomeActivityLocked(int userId, String reason) {
- return startHomeActivityLocked(userId, reason, DEFAULT_DISPLAY);
- }
-
- /**
- * This starts home activity on displays that can have system decorations and only if the
- * home activity can have multiple instances.
- */
- boolean startHomeActivityLocked(int userId, String reason, int displayId) {
- if (mFactoryTest == FactoryTest.FACTORY_TEST_LOW_LEVEL
- && mTopAction == null) {
- // We are running in factory test mode, but unable to find
- // the factory test app, so just sit around displaying the
- // error message and don't try to start anything.
- return false;
- }
- Intent intent = getHomeIntent();
- ActivityInfo aInfo = resolveActivityInfo(intent, STOCK_PM_FLAGS, userId);
- if (aInfo != null) {
- intent.setComponent(new ComponentName(aInfo.applicationInfo.packageName, aInfo.name));
- // Don't do this if the home app is currently being
- // instrumented.
- aInfo = new ActivityInfo(aInfo);
- aInfo.applicationInfo = getAppInfoForUser(aInfo.applicationInfo, userId);
- ProcessRecord app = getProcessRecordLocked(aInfo.processName,
- aInfo.applicationInfo.uid, true);
- if (app == null || app.getActiveInstrumentation() == null) {
- intent.setFlags(intent.getFlags() | FLAG_ACTIVITY_NEW_TASK);
- final int resolvedUserId = UserHandle.getUserId(aInfo.applicationInfo.uid);
- // For ANR debugging to verify if the user activity is the one that actually
- // launched.
- final String myReason = reason + ":" + userId + ":" + resolvedUserId;
- mActivityTaskManager.getActivityStartController().startHomeActivity(intent, aInfo,
- myReason, displayId);
- }
- } else {
- Slog.wtf(TAG, "No home screen found for " + intent, new Throwable());
- }
-
- return true;
- }
-
- private ActivityInfo resolveActivityInfo(Intent intent, int flags, int userId) {
- ActivityInfo ai = null;
- ComponentName comp = intent.getComponent();
- try {
- if (comp != null) {
- // Factory test.
- ai = AppGlobals.getPackageManager().getActivityInfo(comp, flags, userId);
- } else {
- ResolveInfo info = AppGlobals.getPackageManager().resolveIntent(
- intent,
- intent.resolveTypeIfNeeded(mContext.getContentResolver()),
- flags, userId);
-
- if (info != null) {
- ai = info.activityInfo;
- }
- }
- } catch (RemoteException e) {
- // ignore
- }
-
- return ai;
- }
-
boolean getCheckedForSetup() {
return mCheckedForSetup;
}
@@ -6722,7 +6624,7 @@ public class ActivityManagerService extends IActivityManager.Stub
}
}
- static int checkComponentPermission(String permission, int pid, int uid,
+ public static int checkComponentPermission(String permission, int pid, int uid,
int owningUid, boolean exported) {
if (pid == MY_PID) {
return PackageManager.PERMISSION_GRANTED;
@@ -8804,7 +8706,7 @@ public class ActivityManagerService extends IActivityManager.Stub
if (mActivityTaskManager.mKeyguardController.isKeyguardLocked()) {
// Showing launcher to avoid user entering credential twice.
final int currentUserId = mUserController.getCurrentUserId();
- startHomeActivityLocked(currentUserId, "notifyLockedProfile");
+ mAtmInternal.startHomeActivity(currentUserId, "notifyLockedProfile");
}
mStackSupervisor.lockAllProfileTasks(userId);
}
@@ -9817,8 +9719,6 @@ public class ActivityManagerService extends IActivityManager.Stub
return;
}
- mHasHeavyWeightFeature = mContext.getPackageManager().hasSystemFeature(
- PackageManager.FEATURE_CANT_SAVE_STATE);
mLocalDeviceIdleController
= LocalServices.getService(DeviceIdleController.LocalService.class);
mActivityTaskManager.onSystemReady();
@@ -9863,44 +9763,9 @@ public class ActivityManagerService extends IActivityManager.Stub
}
Slog.i(TAG, "System now ready");
- EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_AMS_READY,
- SystemClock.uptimeMillis());
+ EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_AMS_READY, SystemClock.uptimeMillis());
- synchronized(this) {
- // Make sure we have no pre-ready processes sitting around.
-
- if (mFactoryTest == FactoryTest.FACTORY_TEST_LOW_LEVEL) {
- ResolveInfo ri = mContext.getPackageManager()
- .resolveActivity(new Intent(Intent.ACTION_FACTORY_TEST),
- STOCK_PM_FLAGS);
- CharSequence errorMsg = null;
- if (ri != null) {
- ActivityInfo ai = ri.activityInfo;
- ApplicationInfo app = ai.applicationInfo;
- if ((app.flags&ApplicationInfo.FLAG_SYSTEM) != 0) {
- mTopAction = Intent.ACTION_FACTORY_TEST;
- mTopData = null;
- mTopComponent = new ComponentName(app.packageName,
- ai.name);
- } else {
- errorMsg = mContext.getResources().getText(
- com.android.internal.R.string.factorytest_not_system);
- }
- } else {
- errorMsg = mContext.getResources().getText(
- com.android.internal.R.string.factorytest_no_action);
- }
- if (errorMsg != null) {
- mTopAction = null;
- mTopData = null;
- mTopComponent = null;
- Message msg = Message.obtain();
- msg.what = SHOW_FACTORY_ERROR_UI_MSG;
- msg.getData().putCharSequence("msg", errorMsg);
- mUiHandler.sendMessage(msg);
- }
- }
- }
+ mAtmInternal.updateTopComponentForFactoryTest();
retrieveSettings();
final int currentUserId = mUserController.getCurrentUserId();
@@ -9946,7 +9811,7 @@ public class ActivityManagerService extends IActivityManager.Stub
throw e.rethrowAsRuntimeException();
}
}
- startHomeActivityLocked(currentUserId, "systemReady");
+ mAtmInternal.startHomeActivity(currentUserId, "systemReady");
mAtmInternal.showSystemReadyErrorDialogsIfNeeded();
@@ -20821,13 +20686,6 @@ public class ActivityManagerService extends IActivityManager.Stub
}
@Override
- public Intent getHomeIntent() {
- synchronized (ActivityManagerService.this) {
- return ActivityManagerService.this.getHomeIntent();
- }
- }
-
- @Override
public void scheduleAppGcs() {
synchronized (ActivityManagerService.this) {
ActivityManagerService.this.scheduleAppGcsLocked();
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index a968ae4e0201..3f2c650256d2 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -42,6 +42,7 @@ import static android.app.WindowConfiguration.activityTypeToString;
import static android.app.WindowConfiguration.windowingModeToString;
import static android.content.pm.ActivityInfo.LAUNCH_SINGLE_INSTANCE;
import static android.content.pm.ActivityInfo.LAUNCH_SINGLE_TASK;
+import static android.content.pm.PackageManager.NOTIFY_PACKAGE_USE_ACTIVITY;
import static android.content.pm.PackageManager.PERMISSION_DENIED;
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
import static android.graphics.Rect.copyOrNull;
@@ -824,7 +825,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
moveFocusableActivityToTop(r, myReason);
return resumeFocusedStacksTopActivitiesLocked(r.getStack(), prev, null);
}
- return mService.mAm.startHomeActivityLocked(mCurrentUser, myReason, displayId);
+ return mService.startHomeActivityLocked(mCurrentUser, myReason, displayId);
}
boolean canStartHomeOnDisplay(ActivityInfo homeActivity, int displayId) {
@@ -1522,8 +1523,8 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
// Home process is the root process of the task.
mService.mHomeProcess = task.mActivities.get(0).app;
}
- mService.mAm.notifyPackageUse(r.intent.getComponent().getPackageName(),
- PackageManager.NOTIFY_PACKAGE_USE_ACTIVITY);
+ mService.getPackageManagerInternalLocked().notifyPackageUse(
+ r.intent.getComponent().getPackageName(), NOTIFY_PACKAGE_USE_ACTIVITY);
r.sleeping = false;
r.forceNewConfig = false;
mService.getAppWarningsLocked().onStartActivity(r);
@@ -1588,7 +1589,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
mService.getLifecycleManager().scheduleTransaction(clientTransaction);
if ((app.info.privateFlags & ApplicationInfo.PRIVATE_FLAG_CANT_SAVE_STATE) != 0
- && mService.mAm.mHasHeavyWeightFeature) {
+ && mService.mHasHeavyWeightFeature) {
// This may be a heavy-weight process! Note that the package manager will ensure
// that only activity can run in the main process of the .apk, which is the only
// thing that will be considered heavy-weight.
@@ -1957,7 +1958,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
private int getComponentRestrictionForCallingPackage(ActivityInfo activityInfo,
String callingPackage, int callingPid, int callingUid, boolean ignoreTargetSecurity) {
- if (!ignoreTargetSecurity && mService.mAm.checkComponentPermission(activityInfo.permission,
+ if (!ignoreTargetSecurity && mService.checkComponentPermission(activityInfo.permission,
callingPid, callingUid, activityInfo.applicationInfo.uid, activityInfo.exported)
== PERMISSION_DENIED) {
return ACTIVITY_RESTRICTION_PERMISSION;
@@ -4280,7 +4281,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
private void handleDisplayAdded(int displayId) {
synchronized (mService.mGlobalLock) {
getActivityDisplayOrCreateLocked(displayId);
- mService.mAm.startHomeActivityLocked(mCurrentUser, "displayAdded", displayId);
+ mService.startHomeActivityLocked(mCurrentUser, "displayAdded", displayId);
}
}
diff --git a/services/core/java/com/android/server/am/ActivityStartController.java b/services/core/java/com/android/server/am/ActivityStartController.java
index 5e73bc3a2259..f6f1e5508957 100644
--- a/services/core/java/com/android/server/am/ActivityStartController.java
+++ b/services/core/java/com/android/server/am/ActivityStartController.java
@@ -21,6 +21,7 @@ import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
+import static android.os.FactoryTest.FACTORY_TEST_LOW_LEVEL;
import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM;
import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME;
@@ -200,9 +201,8 @@ public class ActivityStartController {
// version than the last one shown, and we are not running in
// low-level factory test mode.
final ContentResolver resolver = mService.mContext.getContentResolver();
- if (mService.mAm.mFactoryTest != FactoryTest.FACTORY_TEST_LOW_LEVEL &&
- Settings.Global.getInt(resolver,
- Settings.Global.DEVICE_PROVISIONED, 0) != 0) {
+ if (mService.mFactoryTest != FACTORY_TEST_LOW_LEVEL
+ && Settings.Global.getInt(resolver, Settings.Global.DEVICE_PROVISIONED, 0) != 0) {
mService.mAm.setCheckedForSetup(true);
// See if we should be showing the platform update setup UI.
diff --git a/services/core/java/com/android/server/am/ActivityStarter.java b/services/core/java/com/android/server/am/ActivityStarter.java
index de3b9cf3ccde..2bd22e8601d6 100644
--- a/services/core/java/com/android/server/am/ActivityStarter.java
+++ b/services/core/java/com/android/server/am/ActivityStarter.java
@@ -1076,7 +1076,7 @@ class ActivityStarter {
if (aInfo != null &&
(aInfo.applicationInfo.privateFlags
& ApplicationInfo.PRIVATE_FLAG_CANT_SAVE_STATE) != 0 &&
- mService.mAm.mHasHeavyWeightFeature) {
+ mService.mHasHeavyWeightFeature) {
// This may be a heavy-weight process! Check to see if we already
// have another, different heavy-weight process running.
if (aInfo.processName.equals(aInfo.applicationInfo.packageName)) {
diff --git a/services/core/java/com/android/server/am/ActivityTaskManagerService.java b/services/core/java/com/android/server/am/ActivityTaskManagerService.java
index c1eab821d084..8e3eeae5d569 100644
--- a/services/core/java/com/android/server/am/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityTaskManagerService.java
@@ -39,6 +39,7 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMAR
import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY;
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
+import static android.content.pm.ApplicationInfo.FLAG_FACTORY_TEST;
import static android.content.pm.PackageManager.FEATURE_ACTIVITIES_ON_SECONDARY_DISPLAYS;
import static android.content.pm.PackageManager.FEATURE_FREEFORM_WINDOW_MANAGEMENT;
import static android.content.pm.PackageManager.FEATURE_PC;
@@ -46,6 +47,9 @@ import static android.content.pm.PackageManager.FEATURE_PICTURE_IN_PICTURE;
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
import static android.content.res.Configuration.UI_MODE_TYPE_TELEVISION;
import static android.os.Build.VERSION_CODES.N;
+import static android.os.FactoryTest.FACTORY_TEST_HIGH_LEVEL;
+import static android.os.FactoryTest.FACTORY_TEST_LOW_LEVEL;
+import static android.os.FactoryTest.FACTORY_TEST_OFF;
import static android.os.Process.SYSTEM_UID;
import static android.os.Trace.TRACE_TAG_ACTIVITY_MANAGER;
import static android.provider.Settings.Global.ALWAYS_FINISH_ACTIVITIES;
@@ -86,7 +90,6 @@ import static com.android.server.am.ActivityManagerService.MY_PID;
import static com.android.server.am.ActivityManagerService.SEND_LOCALE_TO_MOUNT_DAEMON_MSG;
import static com.android.server.am.ActivityManagerService.STOCK_PM_FLAGS;
import static com.android.server.am.ActivityManagerService.UPDATE_CONFIGURATION_MSG;
-import static com.android.server.am.ActivityManagerService.checkComponentPermission;
import static com.android.server.am.ActivityManagerService.dumpStackTraces;
import static com.android.server.am.ActivityStack.REMOVE_TASK_MODE_DESTROYING;
import static com.android.server.am.ActivityStackSupervisor.DEFER_RESUME;
@@ -167,6 +170,7 @@ import android.net.Uri;
import android.os.Binder;
import android.os.Build;
import android.os.Bundle;
+import android.os.FactoryTest;
import android.os.FileUtils;
import android.os.Handler;
import android.os.IBinder;
@@ -293,6 +297,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
WindowProcessController mHomeProcess;
/** The currently running heavy-weight process, if any. */
WindowProcessController mHeavyWeightProcess = null;
+ boolean mHasHeavyWeightFeature;
/**
* This is the process holding the activity the user last visited that is in a different process
* from the one they are currently in.
@@ -388,6 +393,13 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
IActivityController mController = null;
boolean mControllerIsAMonkey = false;
+ final int mFactoryTest;
+
+ /** Used to control how we initialize the service. */
+ ComponentName mTopComponent;
+ String mTopAction = Intent.ACTION_MAIN;
+ String mTopData;
+
/**
* Used to retain an update lock when the foreground activity is in
* immersive mode.
@@ -524,11 +536,14 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
ActivityTaskManagerService(Context context) {
mContext = context;
+ mFactoryTest = FactoryTest.getMode();
mUiContext = ActivityThread.currentActivityThread().getSystemUiContext();
mLifecycleManager = new ClientLifecycleManager();
}
void onSystemReady() {
+ mHasHeavyWeightFeature = mContext.getPackageManager().hasSystemFeature(
+ PackageManager.FEATURE_CANT_SAVE_STATE);
mAssistUtils = new AssistUtils(mContext);
mVrController.onSystemReady();
mRecentTasks.onSystemReadyLocked();
@@ -2970,7 +2985,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
}
/** This can be called with or without the global lock held. */
- void enforceCallerIsRecentsOrHasPermission(String permission, String func) {
+ private void enforceCallerIsRecentsOrHasPermission(String permission, String func) {
if (!getRecentTasks().isCallerRecents(Binder.getCallingUid())) {
mAmInternal.enforceCallingPermission(permission, func);
}
@@ -2988,6 +3003,12 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
return checkComponentPermission(permission, pid, uid, -1, true);
}
+ public static int checkComponentPermission(String permission, int pid, int uid,
+ int owningUid, boolean exported) {
+ return ActivityManagerService.checkComponentPermission(
+ permission, pid, uid, owningUid, exported);
+ }
+
boolean isGetTasksAllowed(String caller, int callingPid, int callingUid) {
if (getRecentTasks().isCallerRecents(callingUid)) {
// Always allow the recents component to get tasks
@@ -5155,6 +5176,103 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
return mAppWarnings;
}
+ Intent getHomeIntent() {
+ Intent intent = new Intent(mTopAction, mTopData != null ? Uri.parse(mTopData) : null);
+ intent.setComponent(mTopComponent);
+ intent.addFlags(Intent.FLAG_DEBUG_TRIAGED_MISSING);
+ if (mFactoryTest != FactoryTest.FACTORY_TEST_LOW_LEVEL) {
+ intent.addCategory(Intent.CATEGORY_HOME);
+ }
+ return intent;
+ }
+
+ /**
+ * This starts home activity on displays that can have system decorations and only if the
+ * home activity can have multiple instances.
+ */
+ boolean startHomeActivityLocked(int userId, String reason, int displayId) {
+ if (mFactoryTest == FactoryTest.FACTORY_TEST_LOW_LEVEL && mTopAction == null) {
+ // We are running in factory test mode, but unable to find the factory test app, so just
+ // sit around displaying the error message and don't try to start anything.
+ return false;
+ }
+
+ final Intent intent = getHomeIntent();
+ ActivityInfo aInfo = resolveActivityInfo(intent, STOCK_PM_FLAGS, userId);
+ if (aInfo != null) {
+ intent.setComponent(new ComponentName(aInfo.applicationInfo.packageName, aInfo.name));
+ // Don't do this if the home app is currently being instrumented.
+ aInfo = new ActivityInfo(aInfo);
+ aInfo.applicationInfo = getAppInfoForUser(aInfo.applicationInfo, userId);
+ WindowProcessController app =
+ getProcessController(aInfo.processName, aInfo.applicationInfo.uid);
+ if (app == null || !app.isInstrumenting()) {
+ intent.setFlags(intent.getFlags() | FLAG_ACTIVITY_NEW_TASK);
+ final int resolvedUserId = UserHandle.getUserId(aInfo.applicationInfo.uid);
+ // For ANR debugging to verify if the user activity is the one that actually
+ // launched.
+ final String myReason = reason + ":" + userId + ":" + resolvedUserId;
+ getActivityStartController().startHomeActivity(intent, aInfo, myReason, displayId);
+ }
+ } else {
+ Slog.wtf(TAG, "No home screen found for " + intent, new Throwable());
+ }
+
+ return true;
+ }
+
+ private ActivityInfo resolveActivityInfo(Intent intent, int flags, int userId) {
+ ActivityInfo ai = null;
+ final ComponentName comp = intent.getComponent();
+ try {
+ if (comp != null) {
+ // Factory test.
+ ai = AppGlobals.getPackageManager().getActivityInfo(comp, flags, userId);
+ } else {
+ ResolveInfo info = AppGlobals.getPackageManager().resolveIntent(
+ intent,
+ intent.resolveTypeIfNeeded(mContext.getContentResolver()),
+ flags, userId);
+
+ if (info != null) {
+ ai = info.activityInfo;
+ }
+ }
+ } catch (RemoteException e) {
+ // ignore
+ }
+
+ return ai;
+ }
+
+ ApplicationInfo getAppInfoForUser(ApplicationInfo info, int userId) {
+ if (info == null) return null;
+ ApplicationInfo newInfo = new ApplicationInfo(info);
+ newInfo.initForUser(userId);
+ return newInfo;
+ }
+
+ private WindowProcessController getProcessController(String processName, int uid) {
+ if (uid == SYSTEM_UID) {
+ // The system gets to run in any process. If there are multiple processes with the same
+ // uid, just pick the first (this should never happen).
+ final SparseArray<WindowProcessController> procs =
+ mProcessNames.getMap().get(processName);
+ if (procs == null) return null;
+ final int procCount = procs.size();
+ for (int i = 0; i < procCount; i++) {
+ final int procUid = procs.keyAt(i);
+ if (UserHandle.isApp(procUid) || !UserHandle.isSameUser(procUid, uid)) {
+ // Don't use an app process or different user process for system component.
+ continue;
+ }
+ return procs.valueAt(i);
+ }
+ }
+
+ return mProcessNames.get(processName, uid);
+ }
+
void logAppTooSlow(WindowProcessController app, long startTime, String msg) {
if (true || Build.IS_USER) {
return;
@@ -5795,5 +5913,74 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
return r.mServiceConnectionsHolder;
}
}
+
+ @Override
+ public Intent getHomeIntent() {
+ synchronized (mGlobalLock) {
+ return ActivityTaskManagerService.this.getHomeIntent();
+ }
+ }
+
+ @Override
+ public boolean startHomeActivity(int userId, String reason) {
+ synchronized (mGlobalLock) {
+ return startHomeActivityLocked(userId, reason, DEFAULT_DISPLAY);
+ }
+ }
+
+ @Override
+ public boolean isFactoryTestProcess(WindowProcessController wpc) {
+ synchronized (mGlobalLock) {
+ if (mFactoryTest == FACTORY_TEST_OFF) {
+ return false;
+ }
+ if (mFactoryTest == FACTORY_TEST_LOW_LEVEL && mTopComponent != null
+ && wpc.mName.equals(mTopComponent.getPackageName())) {
+ return true;
+ }
+ return mFactoryTest == FACTORY_TEST_HIGH_LEVEL
+ && (wpc.mInfo.flags & FLAG_FACTORY_TEST) != 0;
+ }
+ }
+
+ @Override
+ public void updateTopComponentForFactoryTest() {
+ synchronized (mGlobalLock) {
+ if (mFactoryTest != FACTORY_TEST_LOW_LEVEL) {
+ return;
+ }
+ final ResolveInfo ri = mContext.getPackageManager()
+ .resolveActivity(new Intent(Intent.ACTION_FACTORY_TEST), STOCK_PM_FLAGS);
+ final CharSequence errorMsg;
+ if (ri != null) {
+ final ActivityInfo ai = ri.activityInfo;
+ final ApplicationInfo app = ai.applicationInfo;
+ if ((app.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
+ mTopAction = Intent.ACTION_FACTORY_TEST;
+ mTopData = null;
+ mTopComponent = new ComponentName(app.packageName, ai.name);
+ errorMsg = null;
+ } else {
+ errorMsg = mContext.getResources().getText(
+ com.android.internal.R.string.factorytest_not_system);
+ }
+ } else {
+ errorMsg = mContext.getResources().getText(
+ com.android.internal.R.string.factorytest_no_action);
+ }
+ if (errorMsg == null) {
+ return;
+ }
+
+ mTopAction = null;
+ mTopData = null;
+ mTopComponent = null;
+ mUiHandler.post(() -> {
+ Dialog d = new FactoryErrorDialog(mUiContext, errorMsg);
+ d.show();
+ mAm.ensureBootCompleted();
+ });
+ }
+ }
}
}
diff --git a/services/core/java/com/android/server/am/RecentTasks.java b/services/core/java/com/android/server/am/RecentTasks.java
index 4d0b1da98fde..dd13e9868b1d 100644
--- a/services/core/java/com/android/server/am/RecentTasks.java
+++ b/services/core/java/com/android/server/am/RecentTasks.java
@@ -755,7 +755,7 @@ class RecentTasks {
boolean getTasksAllowed, boolean getDetailedTasks, int userId, int callingUid) {
final boolean withExcluded = (flags & RECENT_WITH_EXCLUDED) != 0;
- if (!mService.mAm.isUserRunning(userId, FLAG_AND_UNLOCKED)) {
+ if (!mService.mAmInternal.isUserRunning(userId, FLAG_AND_UNLOCKED)) {
Slog.i(TAG, "user " + userId + " is still locked. Cannot load recents");
return new ArrayList<>();
}
diff --git a/services/core/java/com/android/server/am/UserController.java b/services/core/java/com/android/server/am/UserController.java
index 8154062fa582..3a897c4d525c 100644
--- a/services/core/java/com/android/server/am/UserController.java
+++ b/services/core/java/com/android/server/am/UserController.java
@@ -2178,9 +2178,7 @@ class UserController implements Handler.Callback {
}
protected void startHomeActivity(int userId, String reason) {
- synchronized (mService) {
- mService.startHomeActivityLocked(userId, reason);
- }
+ mService.mAtmInternal.startHomeActivity(userId, reason);
}
void startUserWidgets(int userId) {
diff --git a/services/core/java/com/android/server/biometrics/AuthenticationClient.java b/services/core/java/com/android/server/biometrics/AuthenticationClient.java
index 8a72a6d215ba..bdbb0a40d797 100644
--- a/services/core/java/com/android/server/biometrics/AuthenticationClient.java
+++ b/services/core/java/com/android/server/biometrics/AuthenticationClient.java
@@ -232,6 +232,7 @@ public abstract class AuthenticationClient extends ClientMonitor {
public boolean onAuthenticated(BiometricAuthenticator.Identifier identifier,
boolean authenticated, ArrayList<Byte> token) {
if (authenticated) {
+ mAlreadyDone = true;
if (mRequireConfirmation) {
// Store the token so it can be sent to keystore after the user presses confirm
mEscrow = new TokenEscrow(identifier, token);
diff --git a/services/core/java/com/android/server/biometrics/BiometricService.java b/services/core/java/com/android/server/biometrics/BiometricService.java
index abc0107f8eaa..3d2f5677cafb 100644
--- a/services/core/java/com/android/server/biometrics/BiometricService.java
+++ b/services/core/java/com/android/server/biometrics/BiometricService.java
@@ -260,7 +260,7 @@ public class BiometricService extends SystemService {
final int callingUserId = UserHandle.getCallingUserId();
mHandler.post(() -> {
- final Pair<Integer, Integer> result = checkAndGetBiometricModality();
+ final Pair<Integer, Integer> result = checkAndGetBiometricModality(callingUserId);
final int modality = result.first;
final int error = result.second;
@@ -351,10 +351,11 @@ public class BiometricService extends SystemService {
checkPermission();
checkAppOp(opPackageName, Binder.getCallingUid());
+ final int userId = UserHandle.getCallingUserId();
final long ident = Binder.clearCallingIdentity();
int error;
try {
- final Pair<Integer, Integer> result = checkAndGetBiometricModality();
+ final Pair<Integer, Integer> result = checkAndGetBiometricModality(userId);
error = result.second;
} finally {
Binder.restoreCallingIdentity(ident);
@@ -466,7 +467,7 @@ public class BiometricService extends SystemService {
* {@link #BIOMETRIC_FINGERPRINT}, {@link #BIOMETRIC_IRIS}, {@link #BIOMETRIC_FACE}
* and the error containing one of the {@link BiometricConstants} errors.
*/
- private Pair<Integer, Integer> checkAndGetBiometricModality() {
+ private Pair<Integer, Integer> checkAndGetBiometricModality(int callingUid) {
int modality = BIOMETRIC_NONE;
// No biometric features, send error
@@ -495,9 +496,12 @@ public class BiometricService extends SystemService {
// order.
firstHwAvailable = modality;
}
- if (authenticator.hasEnrolledTemplates()) {
+ if (authenticator.hasEnrolledTemplates(callingUid)) {
hasTemplatesEnrolled = true;
if (isEnabledForApp(modality)) {
+ // TODO(b/110907543): When face settings (and other settings) have both a
+ // user toggle as well as a work profile settings page, this needs to be
+ // updated to reflect the correct setting.
enabledForApps = true;
break;
}
diff --git a/services/core/java/com/android/server/biometrics/BiometricServiceBase.java b/services/core/java/com/android/server/biometrics/BiometricServiceBase.java
index 6a2219366c8a..71bf56085452 100644
--- a/services/core/java/com/android/server/biometrics/BiometricServiceBase.java
+++ b/services/core/java/com/android/server/biometrics/BiometricServiceBase.java
@@ -408,7 +408,8 @@ public abstract class BiometricServiceBase extends SystemService
mActivityTaskManager.getTasks(1);
if (!runningTasks.isEmpty()) {
final String topPackage = runningTasks.get(0).topActivity.getPackageName();
- if (!topPackage.contentEquals(currentClient)) {
+ if (!topPackage.contentEquals(currentClient)
+ && !mCurrentClient.isAlreadyDone()) {
Slog.e(getTag(), "Stopping background authentication, top: " + topPackage
+ " currentClient: " + currentClient);
mCurrentClient.stop(false /* initiatedByClient */);
diff --git a/services/core/java/com/android/server/biometrics/ClientMonitor.java b/services/core/java/com/android/server/biometrics/ClientMonitor.java
index d1daad583fff..22b7418b53b7 100644
--- a/services/core/java/com/android/server/biometrics/ClientMonitor.java
+++ b/services/core/java/com/android/server/biometrics/ClientMonitor.java
@@ -63,6 +63,7 @@ public abstract class ClientMonitor implements IBinder.DeathRecipient {
protected final Metrics mMetrics;
protected boolean mAlreadyCancelled;
+ protected boolean mAlreadyDone;
/**
* @param context context of BiometricService
@@ -136,6 +137,11 @@ public abstract class ClientMonitor implements IBinder.DeathRecipient {
public abstract boolean onEnumerationResult(
BiometricAuthenticator.Identifier identifier, int remaining);
+
+ public boolean isAlreadyDone() {
+ return mAlreadyDone;
+ }
+
/**
* Called when we get notification from the biometric's HAL that an image has been acquired.
* Common to authenticate and enroll.
diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java
index b3f2a27cf99a..43a9c782b8d6 100644
--- a/services/core/java/com/android/server/power/PowerManagerService.java
+++ b/services/core/java/com/android/server/power/PowerManagerService.java
@@ -1079,18 +1079,39 @@ public final class PowerManagerService extends SystemService
return false;
}
+ private static WorkChain getFirstNonEmptyWorkChain(WorkSource workSource) {
+ if (workSource.getWorkChains() == null) {
+ return null;
+ }
+
+ for (WorkChain workChain: workSource.getWorkChains()) {
+ if (workChain.getSize() > 0) {
+ return workChain;
+ }
+ }
+
+ return null;
+ }
+
private void applyWakeLockFlagsOnAcquireLocked(WakeLock wakeLock, int uid) {
if ((wakeLock.mFlags & PowerManager.ACQUIRE_CAUSES_WAKEUP) != 0
&& isScreenLock(wakeLock)) {
String opPackageName;
int opUid;
- if (wakeLock.mWorkSource != null && wakeLock.mWorkSource.getName(0) != null) {
- opPackageName = wakeLock.mWorkSource.getName(0);
- opUid = wakeLock.mWorkSource.get(0);
+ if (wakeLock.mWorkSource != null && !wakeLock.mWorkSource.isEmpty()) {
+ WorkSource workSource = wakeLock.mWorkSource;
+ WorkChain workChain = getFirstNonEmptyWorkChain(workSource);
+ if (workChain != null) {
+ opPackageName = workChain.getAttributionTag();
+ opUid = workChain.getAttributionUid();
+ } else {
+ opPackageName = workSource.getName(0) != null
+ ? workSource.getName(0) : wakeLock.mPackageName;
+ opUid = workSource.get(0);
+ }
} else {
opPackageName = wakeLock.mPackageName;
- opUid = wakeLock.mWorkSource != null ? wakeLock.mWorkSource.get(0)
- : wakeLock.mOwnerUid;
+ opUid = wakeLock.mOwnerUid;
}
wakeUpNoUpdateLocked(SystemClock.uptimeMillis(), wakeLock.mTag, opUid,
opPackageName, opUid);
diff --git a/services/core/java/com/android/server/stats/StatsCompanionService.java b/services/core/java/com/android/server/stats/StatsCompanionService.java
index 97992cf1232b..1abaaf2412bf 100644
--- a/services/core/java/com/android/server/stats/StatsCompanionService.java
+++ b/services/core/java/com/android/server/stats/StatsCompanionService.java
@@ -1259,18 +1259,19 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
Binder.restoreCallingIdentity(token);
}
- long mLastProcStatsHighWaterMark = readProcStatsHighWaterMark();
-
- private long readProcStatsHighWaterMark() {
+ // read high watermark for section
+ private long readProcStatsHighWaterMark(int section) {
try {
- File[] files = mBaseDir.listFiles();
+ File[] files = mBaseDir.listFiles((d, name) -> {
+ return name.toLowerCase().startsWith(String.valueOf(section) + '_');
+ });
if (files == null || files.length == 0) {
return 0;
}
if (files.length > 1) {
Log.e(TAG, "Only 1 file expected for high water mark. Found " + files.length);
}
- return Long.valueOf(files[0].getName());
+ return Long.valueOf(files[0].getName().split("_")[1]);
} catch (SecurityException e) {
Log.e(TAG, "Failed to get procstats high watermark file.", e);
} catch (NumberFormatException e) {
@@ -1282,13 +1283,13 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
private IProcessStats mProcessStats =
IProcessStats.Stub.asInterface(ServiceManager.getService(ProcessStats.SERVICE_NAME));
- private void pullProcessStats(
- int tagId, long elapsedNanos, long wallClockNanos,
+ private void pullProcessStats(int section, int tagId, long elapsedNanos, long wallClockNanos,
List<StatsLogEventWrapper> pulledData) {
try {
+ long lastHighWaterMark = readProcStatsHighWaterMark(section);
List<ParcelFileDescriptor> statsFiles = new ArrayList<>();
long highWaterMark = mProcessStats.getCommittedStats(
- mLastProcStatsHighWaterMark, ProcessStats.REPORT_ALL, true, statsFiles);
+ lastHighWaterMark, section, true, statsFiles);
if (statsFiles.size() != 1) {
return;
}
@@ -1298,10 +1299,10 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
StatsLogEventWrapper e = new StatsLogEventWrapper(tagId, elapsedNanos, wallClockNanos);
e.writeStorage(Arrays.copyOf(stats, len[0]));
pulledData.add(e);
- new File(mBaseDir.getAbsolutePath() + "/" + mLastProcStatsHighWaterMark).delete();
- mLastProcStatsHighWaterMark = highWaterMark;
+ new File(mBaseDir.getAbsolutePath() + "/" + section + "_" + lastHighWaterMark).delete();
new File(
- mBaseDir.getAbsolutePath() + "/" + mLastProcStatsHighWaterMark).createNewFile();
+ mBaseDir.getAbsolutePath() + "/" + section + "_"
+ + highWaterMark).createNewFile();
} catch (IOException e) {
Log.e(TAG, "Getting procstats failed: ", e);
} catch (RemoteException e) {
@@ -1490,7 +1491,12 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
break;
}
case StatsLog.PROC_STATS: {
- pullProcessStats(tagId, elapsedNanos, wallClockNanos, ret);
+ pullProcessStats(ProcessStats.REPORT_ALL, tagId, elapsedNanos, wallClockNanos, ret);
+ break;
+ }
+ case StatsLog.PROC_STATS_PKG_PROC: {
+ pullProcessStats(ProcessStats.REPORT_PKG_PROC_STATS, tagId, elapsedNanos,
+ wallClockNanos, ret);
break;
}
case StatsLog.DISK_IO: {
diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerInternal.java b/services/core/java/com/android/server/wm/ActivityTaskManagerInternal.java
index db0bd4f72fd4..e5347cfee5a2 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskManagerInternal.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskManagerInternal.java
@@ -336,4 +336,11 @@ public abstract class ActivityTaskManagerInternal {
/** @return the service connection holder for a given activity token. */
public abstract ActivityServiceConnectionsHolder getServiceConnectionsHolder(IBinder token);
+
+ /** @return The intent used to launch the home activity. */
+ public abstract Intent getHomeIntent();
+ public abstract boolean startHomeActivity(int userId, String reason);
+ /** @return true if the given process is the factory test process. */
+ public abstract boolean isFactoryTestProcess(WindowProcessController wpc);
+ public abstract void updateTopComponentForFactoryTest();
}
diff --git a/services/tests/runtests.py b/services/tests/runtests.py
index 7980dc23e8e2..f19cc5d567ec 100755
--- a/services/tests/runtests.py
+++ b/services/tests/runtests.py
@@ -22,8 +22,7 @@ INSTRUMENTED_PACKAGE_RUNNER = ('com.android.frameworks.servicestests/'
'android.support.test.runner.AndroidJUnitRunner')
PACKAGE_WHITELIST = (
- 'android.net',
- 'com.android.server.connectivity',
+ "com.android.server",
)
COLOR_RED = '\033[0;31m'
@@ -37,14 +36,27 @@ def run(shell_command, echo=True):
COLOR_NONE)
return subprocess.check_call(shell_command, shell=True)
-
+# usage:
+# ${ANDROID_BUILD_TOP}/frameworks/base/services/tests/runtests.py : run tests in com.android.server
+# ${ANDROID_BUILD_TOP}/frameworks/base/services/tests/runtests.py -e package [package name, e.g. com.android.server]
+# ${ANDROID_BUILD_TOP}/frameworks/base/services/tests/runtests.py -e class [class name, e.g. com.android.server.MountServiceTests]
+#
+# The available INSTRUMENTED_PACKAGE_RUNNER may differ in different environments.
+# In this case, use "adb shell pm list instrumentation" to query available runners
+# and use the environment variable INSTRUMENTED_PACKAGE_RUNNER to overwrite
+# the default one, e.g.,
+# INSTRUMENTED_PACKAGE_RUNNER=com.android.frameworks.servicestests/androidx.test.runner.AndroidJUnitRunner \
+# ${ANDROID_BUILD_TOP}/frameworks/base/services/tests/runtests.py
+#
def main():
build_top = os.environ.get('ANDROID_BUILD_TOP', None)
out_dir = os.environ.get('OUT', None)
+ runner = os.environ.get('INSTRUMENTED_PACKAGE_RUNNER', None)
if build_top is None or out_dir is None:
print 'You need to source and lunch before you can use this script'
return 1
-
+ if runner is None:
+ runner = INSTRUMENTED_PACKAGE_RUNNER
print 'Building tests...'
run('make -j32 -C %s -f build/core/main.mk '
'MODULES-IN-frameworks-base-services-tests-servicestests' % build_top,
@@ -57,19 +69,19 @@ def main():
apk_path = (
'%s/data/app/FrameworksServicesTests/FrameworksServicesTests.apk' %
out_dir)
- run('adb install -r -g "%s"' % apk_path)
+ run('adb install -t -r -g "%s"' % apk_path)
print 'Running tests...'
if len(sys.argv) != 1:
run('adb shell am instrument -w %s "%s"' %
- (' '.join(sys.argv[1:]), INSTRUMENTED_PACKAGE_RUNNER))
+ (' '.join(sys.argv[1:]), runner))
return 0
# It would be nice if the activity manager accepted a list of packages, but
# in lieu of that...
for package in PACKAGE_WHITELIST:
run('adb shell am instrument -w -e package %s %s' %
- (package, INSTRUMENTED_PACKAGE_RUNNER))
+ (package, runner))
return 0
diff --git a/services/tests/servicestests/src/com/android/server/textservices/LocaleUtilsTest.java b/services/tests/servicestests/src/com/android/server/textservices/LocaleUtilsTest.java
index 3766d24b93d0..ef945e645559 100644
--- a/services/tests/servicestests/src/com/android/server/textservices/LocaleUtilsTest.java
+++ b/services/tests/servicestests/src/com/android/server/textservices/LocaleUtilsTest.java
@@ -19,11 +19,17 @@ package com.android.server.textservices;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
+import org.junit.runner.RunWith;
import java.util.ArrayList;
import java.util.Locale;
+@SmallTest
+@RunWith(AndroidJUnit4.class)
public class LocaleUtilsTest {
private static final Locale LOCALE_EN = new Locale("en");
private static final Locale LOCALE_EN_US = new Locale("en", "US");
diff --git a/telephony/java/android/telephony/DisconnectCause.java b/telephony/java/android/telephony/DisconnectCause.java
index ee5cdc2780db..d7169b23d94b 100644
--- a/telephony/java/android/telephony/DisconnectCause.java
+++ b/telephony/java/android/telephony/DisconnectCause.java
@@ -319,6 +319,29 @@ public class DisconnectCause {
*/
public static final int IMS_SIP_ALTERNATE_EMERGENCY_CALL = 71;
+ /**
+ * Indicates that a new outgoing call cannot be placed because there is already an outgoing
+ * call dialing out.
+ */
+ public static final int ALREADY_DIALING = 72;
+
+ /**
+ * Indicates that a new outgoing call cannot be placed while there is a ringing call.
+ */
+ public static final int CANT_CALL_WHILE_RINGING = 73;
+
+ /**
+ * Indicates that a new outgoing call cannot be placed because calling has been disabled using
+ * the ro.telephony.disable-call system property.
+ */
+ public static final int CALLING_DISABLED = 74;
+
+ /**
+ * Indicates that a new outgoing call cannot be placed because there is currently an ongoing
+ * foreground and background call.
+ */
+ public static final int TOO_MANY_ONGOING_CALLS = 75;
+
//*********************************************************************************************
// When adding a disconnect type:
// 1) Update toString() with the newly added disconnect type.
@@ -474,6 +497,14 @@ public class DisconnectCause {
return "NORMAL_UNSPECIFIED";
case IMS_SIP_ALTERNATE_EMERGENCY_CALL:
return "IMS_SIP_ALTERNATE_EMERGENCY_CALL";
+ case ALREADY_DIALING:
+ return "ALREADY_DIALING";
+ case CANT_CALL_WHILE_RINGING:
+ return "CANT_CALL_WHILE_RINGING";
+ case CALLING_DISABLED:
+ return "CALLING_DISABLED";
+ case TOO_MANY_ONGOING_CALLS:
+ return "TOO_MANY_ONGOING_CALLS";
default:
return "INVALID: " + cause;
}
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 80b6ead339d0..52c8f5a58ebe 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -17,7 +17,6 @@
package android.telephony;
import static android.content.Context.TELECOM_SERVICE;
-
import static com.android.internal.util.Preconditions.checkNotNull;
import android.annotation.IntDef;
@@ -67,7 +66,7 @@ import com.android.ims.internal.IImsServiceFeatureCallback;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telecom.ITelecomService;
import com.android.internal.telephony.CellNetworkScanResult;
-import com.android.internal.telephony.IAnas;
+import com.android.internal.telephony.IAns;
import com.android.internal.telephony.IPhoneSubInfo;
import com.android.internal.telephony.ITelephony;
import com.android.internal.telephony.ITelephonyRegistry;
@@ -168,7 +167,6 @@ public class TelephonyManager {
/** @hide */
static public final int OTASP_SIM_UNPROVISIONED = 5;
-
/** @hide */
static public final int KEY_TYPE_EPDG = 1;
@@ -2925,7 +2923,7 @@ public class TelephonyManager {
* of time the mode may be unknown.
*
* <p>If this object has been created with {@link #createForSubscriptionId}, applies to the
- * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultDataSubscriptionId()}
+ * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultSubscriptionId()}
*
* @return {@link PhoneConstants#LTE_ON_CDMA_UNKNOWN}, {@link PhoneConstants#LTE_ON_CDMA_FALSE}
* or {@link PhoneConstants#LTE_ON_CDMA_TRUE}
@@ -4391,8 +4389,8 @@ public class TelephonyManager {
return ITelephonyRegistry.Stub.asInterface(ServiceManager.getService("telephony.registry"));
}
- private IAnas getIAnas() {
- return IAnas.Stub.asInterface(ServiceManager.getService("ianas"));
+ private IAns getIAns() {
+ return IAns.Stub.asInterface(ServiceManager.getService("ians"));
}
//
@@ -5930,7 +5928,7 @@ public class TelephonyManager {
* Sets the network selection mode to automatic.
*
* <p>If this object has been created with {@link #createForSubscriptionId}, applies to the
- * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultDataSubscriptionId()}
+ * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultSubscriptionId()}
*
* <p>Requires Permission:
* {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} or that the calling
@@ -5955,7 +5953,7 @@ public class TelephonyManager {
* Perform a radio scan and return the list of available networks.
*
* <p>If this object has been created with {@link #createForSubscriptionId}, applies to the
- * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultDataSubscriptionId()}
+ * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultSubscriptionId()}
*
* <p> Note that this scan can take a long time (sometimes minutes) to happen.
*
@@ -6034,7 +6032,7 @@ public class TelephonyManager {
* Ask the radio to connect to the input network and change selection mode to manual.
*
* <p>If this object has been created with {@link #createForSubscriptionId}, applies to the
- * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultDataSubscriptionId()}
+ * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultSubscriptionId()}
*
* <p>Requires Permission:
* {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} or that the calling
@@ -6059,7 +6057,7 @@ public class TelephonyManager {
* Ask the radio to connect to the input network and change selection mode to manual.
*
* <p>If this object has been created with {@link #createForSubscriptionId}, applies to the
- * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultDataSubscriptionId()}
+ * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultSubscriptionId()}
*
* <p>Requires Permission:
* {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} or that the calling
@@ -6092,7 +6090,7 @@ public class TelephonyManager {
* Get the network selection mode.
*
* <p>If this object has been created with {@link #createForSubscriptionId}, applies to the
- * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultDataSubscriptionId()}
+ * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultSubscriptionId()}
* @return the network selection mode.
*
@@ -6982,7 +6980,8 @@ public class TelephonyManager {
try {
ITelephony telephony = getITelephony();
if (telephony != null) {
- isDataRoamingEnabled = telephony.isDataRoamingEnabled(getSubId());
+ isDataRoamingEnabled = telephony.isDataRoamingEnabled(
+ getSubId(SubscriptionManager.getDefaultDataSubscriptionId()));
}
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#isDataRoamingEnabled", e);
@@ -6994,7 +6993,7 @@ public class TelephonyManager {
* Gets the roaming mode for CDMA phone.
*
* <p>If this object has been created with {@link #createForSubscriptionId}, applies to the
- * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultDataSubscriptionId()}
+ * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultSubscriptionId()}
*
* @return one of {@link #CDMA_ROAMING_MODE_RADIO_DEFAULT}, {@link #CDMA_ROAMING_MODE_HOME},
* {@link #CDMA_ROAMING_MODE_AFFILIATED}, {@link #CDMA_ROAMING_MODE_ANY}.
@@ -7019,7 +7018,7 @@ public class TelephonyManager {
* Sets the roaming mode for CDMA phone to the given mode {@code mode}.
*
* <p>If this object has been created with {@link #createForSubscriptionId}, applies to the
- * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultDataSubscriptionId()}
+ * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultSubscriptionId()}
*
* @param mode should be one of {@link #CDMA_ROAMING_MODE_RADIO_DEFAULT},
* {@link #CDMA_ROAMING_MODE_HOME}, {@link #CDMA_ROAMING_MODE_AFFILIATED},
@@ -7088,7 +7087,8 @@ public class TelephonyManager {
try {
ITelephony telephony = getITelephony();
if (telephony != null) {
- telephony.setDataRoamingEnabled(getSubId(), isEnabled);
+ telephony.setDataRoamingEnabled(
+ getSubId(SubscriptionManager.getDefaultDataSubscriptionId()), isEnabled);
}
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#setDataRoamingEnabled", e);
@@ -7881,7 +7881,7 @@ public class TelephonyManager {
* Returns the current {@link ServiceState} information.
*
* <p>If this object has been created with {@link #createForSubscriptionId}, applies to the
- * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultDataSubscriptionId()}
+ * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultSubscriptionId()}
*
* <p>Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
* or that the calling app has carrier privileges (see {@link #hasCarrierPrivileges}).
@@ -8350,7 +8350,7 @@ public class TelephonyManager {
* Checks if phone is in emergency callback mode.
*
* <p>If this object has been created with {@link #createForSubscriptionId}, applies to the
- * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultDataSubscriptionId()}
+ * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultSubscriptionId()}
*
* @return true if phone is in emergency callback mode.
* @hide
@@ -8602,10 +8602,10 @@ public class TelephonyManager {
}
/**
- * Enable or disable AlternativeNetworkAccessService.
+ * Enable or disable AlternativeNetworkService.
*
* This method should be called to enable or disable
- * AlternativeNetworkAccess service on the device.
+ * AlternativeNetwork service on the device.
*
* <p>
* Requires Permission:
@@ -8616,25 +8616,25 @@ public class TelephonyManager {
* @hide
*/
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
- public boolean setAlternativeNetworkAccessState(boolean enable) {
+ public boolean setAlternativeNetworkState(boolean enable) {
String pkgForDebug = mContext != null ? mContext.getOpPackageName() : "<unknown>";
boolean ret = false;
try {
- IAnas iAlternativeAccessService = getIAnas();
- if (iAlternativeAccessService != null) {
- ret = iAlternativeAccessService.setEnable(enable, pkgForDebug);
+ IAns iAlternativeNetworkService = getIAns();
+ if (iAlternativeNetworkService != null) {
+ ret = iAlternativeNetworkService.setEnable(enable, pkgForDebug);
}
} catch (RemoteException ex) {
- Rlog.e(TAG, "enableAlternativeNetworkAccess RemoteException", ex);
+ Rlog.e(TAG, "enableAlternativeNetwork RemoteException", ex);
}
return ret;
}
/**
- * is AlternativeNetworkAccessService enabled
+ * is AlternativeNetworkService enabled
*
- * This method should be called to determine if the AlternativeNetworkAccessService is
+ * This method should be called to determine if the AlternativeNetworkService is
* enabled
*
* <p>
@@ -8643,17 +8643,17 @@ public class TelephonyManager {
* @hide
*/
@RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
- public boolean isAlternativeNetworkAccessEnabled() {
+ public boolean isAlternativeNetworkEnabled() {
String pkgForDebug = mContext != null ? mContext.getOpPackageName() : "<unknown>";
boolean isEnabled = false;
try {
- IAnas iAlternativeAccessService = getIAnas();
- if (iAlternativeAccessService != null) {
- isEnabled = iAlternativeAccessService.isEnabled(pkgForDebug);
+ IAns iAlternativeNetworkService = getIAns();
+ if (iAlternativeNetworkService != null) {
+ isEnabled = iAlternativeNetworkService.isEnabled(pkgForDebug);
}
} catch (RemoteException ex) {
- Rlog.e(TAG, "enableAlternativeNetworkAccess RemoteException", ex);
+ Rlog.e(TAG, "enableAlternativeNetwork RemoteException", ex);
}
return isEnabled;
diff --git a/telephony/java/android/telephony/emergency/EmergencyNumber.aidl b/telephony/java/android/telephony/emergency/EmergencyNumber.aidl
new file mode 100644
index 000000000000..bfb0a59b16c8
--- /dev/null
+++ b/telephony/java/android/telephony/emergency/EmergencyNumber.aidl
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2018, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.telephony.emergency;
+
+parcelable EmergencyNumber;
diff --git a/telephony/java/android/telephony/emergency/EmergencyNumber.java b/telephony/java/android/telephony/emergency/EmergencyNumber.java
new file mode 100644
index 000000000000..d6a08543b9cd
--- /dev/null
+++ b/telephony/java/android/telephony/emergency/EmergencyNumber.java
@@ -0,0 +1,374 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.telephony.emergency;
+
+import android.annotation.IntDef;
+import android.hardware.radio.V1_3.EmergencyNumberSource;
+import android.hardware.radio.V1_3.EmergencyServiceCategory;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * A parcelable class that wraps and retrieves the information of number, service category(s) and
+ * country code for a specific emergency number.
+ */
+public final class EmergencyNumber implements Parcelable {
+
+ private static final String LOG_TAG = "EmergencyNumber";
+
+ /**
+ * Defining Emergency Service Category as follows:
+ * - General emergency call, all categories;
+ * - Police;
+ * - Ambulance;
+ * - Fire Brigade;
+ * - Marine Guard;
+ * - Mountain Rescue;
+ * - Manually Initiated eCall (MIeC);
+ * - Automatically Initiated eCall (AIeC);
+ *
+ * Category UNSPECIFIED (General emergency call, all categories) indicates that no specific
+ * services are associated with this emergency number; if the emergency number is specified,
+ * it has one or more defined emergency service categories.
+ *
+ * Reference: 3gpp 22.101, Section 10 - Emergency Calls
+ *
+ * @hide
+ */
+ @IntDef(flag = true, prefix = { "EMERGENCY_SERVICE_CATEGORY_" }, value = {
+ EMERGENCY_SERVICE_CATEGORY_UNSPECIFIED,
+ EMERGENCY_SERVICE_CATEGORY_POLICE,
+ EMERGENCY_SERVICE_CATEGORY_AMBULANCE,
+ EMERGENCY_SERVICE_CATEGORY_FIRE_BRIGADE,
+ EMERGENCY_SERVICE_CATEGORY_MARINE_GUARD,
+ EMERGENCY_SERVICE_CATEGORY_MOUNTAIN_RESCUE,
+ EMERGENCY_SERVICE_CATEGORY_MIEC,
+ EMERGENCY_SERVICE_CATEGORY_AIEC
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface EmergencyServiceCategories {}
+
+ /**
+ * Emergency Service Category UNSPECIFIED (General emergency call, all categories) bit-field
+ * indicates that no specific services are associated with this emergency number; if the
+ * emergency number is specified, it has one or more defined emergency service categories.
+ *
+ * Reference: 3gpp 22.101, Section 10 - Emergency Calls
+ */
+ public static final int EMERGENCY_SERVICE_CATEGORY_UNSPECIFIED =
+ EmergencyServiceCategory.UNSPECIFIED;
+ /**
+ * Bit-field that indicates Emergency Service Category for Police.
+ *
+ * Reference: 3gpp 22.101, Section 10 - Emergency Calls
+ */
+ public static final int EMERGENCY_SERVICE_CATEGORY_POLICE = EmergencyServiceCategory.POLICE;
+ /**
+ * Bit-field that indicates Emergency Service Category for Ambulance.
+ *
+ * Reference: 3gpp 22.101, Section 10 - Emergency Calls
+ */
+ public static final int EMERGENCY_SERVICE_CATEGORY_AMBULANCE =
+ EmergencyServiceCategory.AMBULANCE;
+ /**
+ * Bit-field that indicates Emergency Service Category for Fire Brigade.
+ *
+ * Reference: 3gpp 22.101, Section 10 - Emergency Calls
+ */
+ public static final int EMERGENCY_SERVICE_CATEGORY_FIRE_BRIGADE =
+ EmergencyServiceCategory.FIRE_BRIGADE;
+ /**
+ * Bit-field that indicates Emergency Service Category for Marine Guard.
+ *
+ * Reference: 3gpp 22.101, Section 10 - Emergency Calls
+ */
+ public static final int EMERGENCY_SERVICE_CATEGORY_MARINE_GUARD =
+ EmergencyServiceCategory.MARINE_GUARD;
+ /**
+ * Bit-field that indicates Emergency Service Category for Mountain Rescue.
+ *
+ * Reference: 3gpp 22.101, Section 10 - Emergency Calls
+ */
+ public static final int EMERGENCY_SERVICE_CATEGORY_MOUNTAIN_RESCUE =
+ EmergencyServiceCategory.MOUNTAIN_RESCUE;
+ /**
+ * Bit-field that indicates Emergency Service Category for Manually Initiated eCall (MIeC)
+ *
+ * Reference: 3gpp 22.101, Section 10 - Emergency Calls
+ */
+ public static final int EMERGENCY_SERVICE_CATEGORY_MIEC = EmergencyServiceCategory.MIEC;
+ /**
+ * Bit-field that indicates Emergency Service Category for Automatically Initiated eCall (AIeC)
+ *
+ * Reference: 3gpp 22.101, Section 10 - Emergency Calls
+ */
+ public static final int EMERGENCY_SERVICE_CATEGORY_AIEC = EmergencyServiceCategory.AIEC;
+
+ private static final Set<Integer> EMERGENCY_SERVICE_CATEGORY_SET;
+ static {
+ EMERGENCY_SERVICE_CATEGORY_SET = new HashSet<Integer>();
+ EMERGENCY_SERVICE_CATEGORY_SET.add(EMERGENCY_SERVICE_CATEGORY_POLICE);
+ EMERGENCY_SERVICE_CATEGORY_SET.add(EMERGENCY_SERVICE_CATEGORY_AMBULANCE);
+ EMERGENCY_SERVICE_CATEGORY_SET.add(EMERGENCY_SERVICE_CATEGORY_FIRE_BRIGADE);
+ EMERGENCY_SERVICE_CATEGORY_SET.add(EMERGENCY_SERVICE_CATEGORY_MARINE_GUARD);
+ EMERGENCY_SERVICE_CATEGORY_SET.add(EMERGENCY_SERVICE_CATEGORY_MOUNTAIN_RESCUE);
+ EMERGENCY_SERVICE_CATEGORY_SET.add(EMERGENCY_SERVICE_CATEGORY_MIEC);
+ EMERGENCY_SERVICE_CATEGORY_SET.add(EMERGENCY_SERVICE_CATEGORY_AIEC);
+ }
+
+ /**
+ * The source to tell where the corresponding @1.3::EmergencyNumber comes from.
+ *
+ * The emergency number has one or more defined emergency number sources.
+ *
+ * Reference: 3gpp 22.101, Section 10 - Emergency Calls
+ *
+ * @hide
+ */
+ @IntDef(flag = true, prefix = { "EMERGENCY_NUMBER_SOURCE_" }, value = {
+ EMERGENCY_NUMBER_SOURCE_NETWORK_SIGNALING,
+ EMERGENCY_NUMBER_SOURCE_SIM,
+ EMERGENCY_NUMBER_SOURCE_MODEM_CONFIG,
+ EMERGENCY_NUMBER_SOURCE_DEFAULT
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface EmergencyNumberSources {}
+
+ /**
+ * Bit-field which indicates the number is from the network signaling.
+ *
+ * Reference: 3gpp 22.101, Section 10 - Emergency Calls
+ */
+ public static final int EMERGENCY_NUMBER_SOURCE_NETWORK_SIGNALING =
+ EmergencyNumberSource.NETWORK_SIGNALING;
+ /**
+ * Bit-field which indicates the number is from the sim.
+ *
+ * Reference: 3gpp 22.101, Section 10 - Emergency Calls
+ */
+ public static final int EMERGENCY_NUMBER_SOURCE_SIM = EmergencyNumberSource.SIM;
+ /** Bit-field which indicates the number is from the modem config. */
+ public static final int EMERGENCY_NUMBER_SOURCE_MODEM_CONFIG =
+ EmergencyNumberSource.MODEM_CONFIG;
+ /**
+ * Bit-field which indicates the number is available as default.
+ *
+ * 112, 911 must always be available; additionally, 000, 08, 110, 999, 118 and 119 must be
+ * available when sim is not present.
+ *
+ * Reference: 3gpp 22.101, Section 10 - Emergency Calls
+ */
+ public static final int EMERGENCY_NUMBER_SOURCE_DEFAULT = EmergencyNumberSource.DEFAULT;
+
+ private static final Set<Integer> EMERGENCY_NUMBER_SOURCE_SET;
+ static {
+ EMERGENCY_NUMBER_SOURCE_SET = new HashSet<Integer>();
+ EMERGENCY_NUMBER_SOURCE_SET.add(EMERGENCY_NUMBER_SOURCE_NETWORK_SIGNALING);
+ EMERGENCY_NUMBER_SOURCE_SET.add(EMERGENCY_NUMBER_SOURCE_SIM);
+ EMERGENCY_NUMBER_SOURCE_SET.add(EMERGENCY_NUMBER_SOURCE_MODEM_CONFIG);
+ EMERGENCY_NUMBER_SOURCE_SET.add(EMERGENCY_NUMBER_SOURCE_DEFAULT);
+ }
+
+ private final String mNumber;
+ private final String mCountryIso;
+ private final int mEmergencyServiceCategoryBitmask;
+ private final int mEmergencyNumberSourceBitmask;
+
+ /** @hide */
+ public EmergencyNumber(String number, String countryIso,
+ int emergencyServiceCategories,
+ int emergencyNumberSources) {
+ this.mNumber = number;
+ this.mCountryIso = countryIso;
+ this.mEmergencyServiceCategoryBitmask = emergencyServiceCategories;
+ this.mEmergencyNumberSourceBitmask = emergencyNumberSources;
+ }
+
+ /** @hide */
+ public EmergencyNumber(Parcel source) {
+ mNumber = source.readString();
+ mCountryIso = source.readString();
+ mEmergencyServiceCategoryBitmask = source.readInt();
+ mEmergencyNumberSourceBitmask = source.readInt();
+ }
+
+ /**
+ * Get the dialing number of the emergency number.
+ *
+ * The character in the number string is only the dial pad
+ * character('0'-'9', '*', or '#'). For example: 911.
+ *
+ * @return the dialing number.
+ */
+ public String getNumber() {
+ return mNumber;
+ }
+
+ /**
+ * Get the country code string (lowercase character) in ISO 3166 format of the emergency number.
+ *
+ * @return the country code string (lowercase character) in ISO 3166 format.
+ */
+ public String getCountryIso() {
+ return mCountryIso;
+ }
+
+ /**
+ * Returns the bitmask of emergency service categories {@link EmergencyServiceCategories} of
+ * the emergency number.
+ *
+ * @return bitmask of the emergency service categories {@link EmergencyServiceCategories}
+ */
+ public @EmergencyServiceCategories int getEmergencyServiceCategoryBitmask() {
+ return mEmergencyServiceCategoryBitmask;
+ }
+
+ /**
+ * Returns the emergency service categories {@link EmergencyServiceCategories} of the emergency
+ * number.
+ *
+ * @return a list of the emergency service categories {@link EmergencyServiceCategories}
+ */
+ public List<Integer> getEmergencyServiceCategories() {
+ List<Integer> categories = new ArrayList<>();
+ if (serviceUnspecified()) {
+ categories.add(EMERGENCY_SERVICE_CATEGORY_UNSPECIFIED);
+ return categories;
+ }
+ for (Integer category : EMERGENCY_SERVICE_CATEGORY_SET) {
+ if (isInEmergencyServiceCategories(category)) {
+ categories.add(category);
+ }
+ }
+ return categories;
+ }
+
+ /**
+ * Checks if the emergency service category is unspecified for the emergency number
+ * {@link #EMERGENCY_SERVICE_CATEGORY_UNSPECIFIED}.
+ *
+ * @return {@code true} if the emergency service category is unspecified for the emergency
+ * number {@link #EMERGENCY_SERVICE_CATEGORY_UNSPECIFIED}; {@code false} otherwise.
+ */
+ private boolean serviceUnspecified() {
+ return mEmergencyServiceCategoryBitmask == EMERGENCY_SERVICE_CATEGORY_UNSPECIFIED;
+ }
+
+ /**
+ * Checks if the emergency number is in the specified emergency service category(s)
+ * {@link EmergencyServiceCategories}.
+ *
+ * @return {@code true} if the emergency number is in the specified emergency service
+ * category(s) {@link EmergencyServiceCategories}; {@code false} otherwise.
+ *
+ * @param categories - emergency service categories {@link EmergencyServiceCategories}
+ */
+ public boolean isInEmergencyServiceCategories(@EmergencyServiceCategories int categories) {
+ if (categories == EMERGENCY_SERVICE_CATEGORY_UNSPECIFIED) {
+ return serviceUnspecified();
+ }
+ return (mEmergencyServiceCategoryBitmask & categories) == categories;
+ }
+
+ /**
+ * Returns the bitmask of the sources {@link EmergencyNumberSources} of the emergency number.
+ *
+ * @return bitmask of the emergency number sources {@link EmergencyNumberSources}
+ */
+ public @EmergencyNumberSources int getEmergencyNumberSourceBitmask() {
+ return mEmergencyNumberSourceBitmask;
+ }
+
+ /**
+ * Returns a list of {@link EmergencyNumberSources} of the emergency number.
+ *
+ * @return a list of {@link EmergencyNumberSources}
+ */
+ public List<Integer> getEmergencyNumberSources() {
+ List<Integer> sources = new ArrayList<>();
+ for (Integer source : EMERGENCY_NUMBER_SOURCE_SET) {
+ if ((mEmergencyNumberSourceBitmask & source) == source) {
+ sources.add(source);
+ }
+ }
+ return sources;
+ }
+
+ /**
+ * Checks if the emergency number is from the specified emergency number source(s)
+ * {@link EmergencyNumberSources}.
+ *
+ * @return {@code true} if the emergency number is from the specified emergency number
+ * source(s) {@link EmergencyNumberSources}; {@code false} otherwise.
+ *
+ * @param sources - {@link EmergencyNumberSources}
+ */
+ public boolean isFromSources(@EmergencyNumberSources int sources) {
+ return (mEmergencyNumberSourceBitmask & sources) == sources;
+ }
+
+ @Override
+ /** @hide */
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeString(mNumber);
+ dest.writeString(mCountryIso);
+ dest.writeInt(mEmergencyServiceCategoryBitmask);
+ dest.writeInt(mEmergencyNumberSourceBitmask);
+ }
+
+ @Override
+ /** @hide */
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public String toString() {
+ return "EmergencyNumber = " + "[Number]" + mNumber + " / [CountryIso]" + mCountryIso
+ + " / [ServiceCategories]"
+ + Integer.toBinaryString(mEmergencyServiceCategoryBitmask)
+ + " / [Sources]" + Integer.toBinaryString(mEmergencyNumberSourceBitmask);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (!EmergencyNumber.class.isInstance(o)) {
+ return false;
+ }
+ return (o == this || toString().equals(o.toString()));
+ }
+
+ public static final Parcelable.Creator<EmergencyNumber> CREATOR =
+ new Parcelable.Creator<EmergencyNumber>() {
+ @Override
+ public EmergencyNumber createFromParcel(Parcel in) {
+ return new EmergencyNumber(in);
+ }
+
+ @Override
+ public EmergencyNumber[] newArray(int size) {
+ return new EmergencyNumber[size];
+ }
+ };
+}
diff --git a/telephony/java/android/telephony/ims/ImsCallSession.java b/telephony/java/android/telephony/ims/ImsCallSession.java
index a20d4f5ad27b..df903cc270a2 100644
--- a/telephony/java/android/telephony/ims/ImsCallSession.java
+++ b/telephony/java/android/telephony/ims/ImsCallSession.java
@@ -16,22 +16,16 @@
package android.telephony.ims;
-import android.annotation.CallbackExecutor;
-import android.annotation.NonNull;
-import android.annotation.SystemApi;
import android.os.Message;
import android.os.RemoteException;
import android.telephony.ims.aidl.IImsCallSessionListener;
-
-import java.util.Objects;
-import java.util.concurrent.Executor;
-
-import android.telephony.ims.stub.ImsCallSessionImplBase;
import android.util.Log;
import com.android.ims.internal.IImsCallSession;
import com.android.ims.internal.IImsVideoCallProvider;
+import java.util.Objects;
+
/**
* Provides the call initiation/termination, and media exchange between two IMS endpoints.
* It directly communicates with IMS service which implements the IMS protocol behavior.
@@ -42,7 +36,8 @@ public class ImsCallSession {
private static final String TAG = "ImsCallSession";
/**
- * Defines IMS call session state. Please use {@link ImsCallSessionImplBase.State} definition.
+ * Defines IMS call session state. Please use
+ * {@link android.telephony.ims.stub.ImsCallSessionImplBase.State} definition.
* This is kept around for capability reasons.
*/
public static class State {
@@ -1027,9 +1022,9 @@ public class ImsCallSession {
}
/**
- * Sends RTT Upgrade request
+ * Sends RTT Upgrade or downgrade request
*
- * @param to : expected profile
+ * @param to Profile with the RTT flag set to the desired value
*/
public void sendRttModifyRequest(ImsCallProfile to) {
if (mClosed) {
diff --git a/telephony/java/com/android/internal/telephony/IAnas.aidl b/telephony/java/com/android/internal/telephony/IAns.aidl
index 88d681a4ec2f..6eb8d666cb1e 100755
--- a/telephony/java/com/android/internal/telephony/IAnas.aidl
+++ b/telephony/java/com/android/internal/telephony/IAns.aidl
@@ -17,13 +17,13 @@
package com.android.internal.telephony;
-interface IAnas {
+interface IAns {
/**
- * Enable or disable Alternative Network Access service.
+ * Enable or disable Alternative Network service.
*
* This method should be called to enable or disable
- * AlternativeNetworkAccess service on the device.
+ * AlternativeNetwork service on the device.
*
* <p>
* Requires Permission:
@@ -37,9 +37,9 @@ interface IAnas {
boolean setEnable(boolean enable, String callingPackage);
/**
- * is Alternative Network Access service enabled
+ * is Alternative Network service enabled
*
- * This method should be called to determine if the Alternative Network Access service is enabled
+ * This method should be called to determine if the Alternative Network service is enabled
*
* <p>
* Requires Permission:
diff --git a/tests/NativeProcessesMemoryTest/src/com/android/tests/nativeprocesses/NativeProcessesMemoryTest.java b/tests/NativeProcessesMemoryTest/src/com/android/tests/nativeprocesses/NativeProcessesMemoryTest.java
index c86f06eb88e4..51302cea730a 100644
--- a/tests/NativeProcessesMemoryTest/src/com/android/tests/nativeprocesses/NativeProcessesMemoryTest.java
+++ b/tests/NativeProcessesMemoryTest/src/com/android/tests/nativeprocesses/NativeProcessesMemoryTest.java
@@ -19,11 +19,15 @@ import com.android.tradefed.device.DeviceNotAvailableException;
import com.android.tradefed.device.ITestDevice;
import com.android.tradefed.log.LogUtil.CLog;
import com.android.tradefed.result.ByteArrayInputStreamSource;
-import com.android.tradefed.result.ITestInvocationListener;
import com.android.tradefed.result.LogDataType;
-import com.android.tradefed.result.TestDescription;
+import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
+import com.android.tradefed.testtype.DeviceJUnit4ClassRunner.TestLogData;
+import com.android.tradefed.testtype.DeviceJUnit4ClassRunner.TestMetrics;
import com.android.tradefed.testtype.IDeviceTest;
-import com.android.tradefed.testtype.IRemoteTest;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import java.util.ArrayList;
import java.util.Arrays;
@@ -58,7 +62,12 @@ import java.util.Scanner;
* - memory usage of each native process (one measurement for each process)
* </pre>
*/
-public class NativeProcessesMemoryTest implements IDeviceTest, IRemoteTest {
+@RunWith(DeviceJUnit4ClassRunner.class)
+public class NativeProcessesMemoryTest implements IDeviceTest {
+
+ @Rule public TestMetrics metrics = new TestMetrics();
+ @Rule public TestLogData logs = new TestLogData();
+
// the dumpsys process comes and go as we run this test, changing pids, so ignore it
private static final List<String> PROCESSES_TO_IGNORE = Arrays.asList("dumpsys");
@@ -68,38 +77,25 @@ public class NativeProcessesMemoryTest implements IDeviceTest, IRemoteTest {
private static final String SEPARATOR = ",";
private static final String LINE_SEPARATOR = "\\n";
- // name of this test run, used for reporting
- private static final String RUN_NAME = "NativeProcessesTest";
// key used to report the number of native processes
private static final String NUM_NATIVE_PROCESSES_KEY = "Num_native_processes";
- private final Map<String, String> mNativeProcessToMemory = new HashMap<String, String>();
// identity for summing over MemoryMetric
private final MemoryMetric mZero = new MemoryMetric(0, 0, 0);
private ITestDevice mTestDevice;
- private ITestInvocationListener mListener;
- public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
- mListener = listener;
+ @Test
+ public void run() throws DeviceNotAvailableException {
// showmap requires root, we enable it here for the rest of the test
- mTestDevice.enableAdbRoot();
-
- listener.testRunStarted(RUN_NAME, 1 /* testCount */);
-
- TestDescription testDescription = new TestDescription(getClass().getName(), "run");
- listener.testStarted(testDescription);
-
+ getDevice().enableAdbRoot();
// process name -> list of pids with that name
Map<String, List<String>> nativeProcesses = collectNativeProcesses();
sampleAndLogAllProcesses(nativeProcesses);
// want to also record the number of native processes
- mNativeProcessToMemory.put(
+ metrics.addTestMetric(
NUM_NATIVE_PROCESSES_KEY, Integer.toString(nativeProcesses.size()));
-
- listener.testEnded(testDescription, mNativeProcessToMemory);
- listener.testRunEnded(0, new HashMap<String, String>());
}
/** Samples memory of all processes and logs the memory use. */
@@ -148,7 +144,7 @@ public class NativeProcessesMemoryTest implements IDeviceTest, IRemoteTest {
*/
private Map<String, List<String>> collectNativeProcesses() throws DeviceNotAvailableException {
HashMap<String, List<String>> nativeProcesses = new HashMap<>();
- String memInfo = mTestDevice.executeShellCommand(DUMPSYS_MEMINFO_OOM_CMD);
+ String memInfo = getDevice().executeShellCommand(DUMPSYS_MEMINFO_OOM_CMD);
for (String line : memInfo.split(LINE_SEPARATOR)) {
String[] splits = line.split(SEPARATOR);
@@ -172,7 +168,7 @@ public class NativeProcessesMemoryTest implements IDeviceTest, IRemoteTest {
private void logShowmap(String label, String showmap) {
try (ByteArrayInputStreamSource source =
new ByteArrayInputStreamSource(showmap.getBytes())) {
- mListener.testLog(label + "_showmap", LogDataType.TEXT, source);
+ logs.addTestLog(label + "_showmap", LogDataType.TEXT, source);
}
}
@@ -183,7 +179,7 @@ public class NativeProcessesMemoryTest implements IDeviceTest, IRemoteTest {
private Optional<MemoryMetric> snapMemoryUsage(String processName, String pid)
throws DeviceNotAvailableException {
// TODO(zhin): copied from com.android.tests.sysmem.host.Metrics#sample(), extract?
- String showmap = mTestDevice.executeShellCommand("showmap " + pid);
+ String showmap = getDevice().executeShellCommand("showmap " + pid);
logShowmap(processName + "_" + pid, showmap);
// CHECKSTYLE:OFF Generated code
@@ -214,9 +210,9 @@ public class NativeProcessesMemoryTest implements IDeviceTest, IRemoteTest {
/** Logs a MemoryMetric of a process. */
private void logMemoryMetric(String processName, MemoryMetric memoryMetric) {
- mNativeProcessToMemory.put(processName + "_pss", Long.toString(memoryMetric.pss));
- mNativeProcessToMemory.put(processName + "_rss", Long.toString(memoryMetric.rss));
- mNativeProcessToMemory.put(processName + "_vss", Long.toString(memoryMetric.vss));
+ metrics.addTestMetric(processName + "_pss", Long.toString(memoryMetric.pss));
+ metrics.addTestMetric(processName + "_rss", Long.toString(memoryMetric.rss));
+ metrics.addTestMetric(processName + "_vss", Long.toString(memoryMetric.vss));
}
/** Container of memory numbers we want to log. */
diff --git a/tests/net/java/com/android/server/IpSecServiceParameterizedTest.java b/tests/net/java/com/android/server/IpSecServiceParameterizedTest.java
index 99a5a69213fa..9b919abfa41d 100644
--- a/tests/net/java/com/android/server/IpSecServiceParameterizedTest.java
+++ b/tests/net/java/com/android/server/IpSecServiceParameterizedTest.java
@@ -16,6 +16,8 @@
package com.android.server;
+import static android.system.OsConstants.AF_INET;
+import static android.system.OsConstants.AF_INET6;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
@@ -34,8 +36,10 @@ import android.net.IpSecAlgorithm;
import android.net.IpSecConfig;
import android.net.IpSecManager;
import android.net.IpSecSpiResponse;
+import android.net.IpSecTransform;
import android.net.IpSecTransformResponse;
import android.net.IpSecTunnelInterfaceResponse;
+import android.net.IpSecUdpEncapResponse;
import android.net.LinkAddress;
import android.net.Network;
import android.net.NetworkUtils;
@@ -62,16 +66,17 @@ public class IpSecServiceParameterizedTest {
private static final int TEST_SPI = 0xD1201D;
- private final String mDestinationAddr;
private final String mSourceAddr;
+ private final String mDestinationAddr;
private final LinkAddress mLocalInnerAddress;
+ private final int mFamily;
@Parameterized.Parameters
public static Collection ipSecConfigs() {
return Arrays.asList(
new Object[][] {
- {"1.2.3.4", "8.8.4.4", "10.0.1.1/24"},
- {"2601::2", "2601::10", "2001:db8::1/64"}
+ {"1.2.3.4", "8.8.4.4", "10.0.1.1/24", AF_INET},
+ {"2601::2", "2601::10", "2001:db8::1/64", AF_INET6}
});
}
@@ -129,12 +134,14 @@ public class IpSecServiceParameterizedTest {
new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
private static final IpSecAlgorithm AEAD_ALGO =
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 128);
+ private static final int REMOTE_ENCAP_PORT = 4500;
public IpSecServiceParameterizedTest(
- String sourceAddr, String destAddr, String localInnerAddr) {
+ String sourceAddr, String destAddr, String localInnerAddr, int family) {
mSourceAddr = sourceAddr;
mDestinationAddr = destAddr;
mLocalInnerAddress = new LinkAddress(localInnerAddr);
+ mFamily = family;
}
@Before
@@ -157,6 +164,8 @@ public class IpSecServiceParameterizedTest {
.thenReturn(AppOpsManager.MODE_IGNORED);
}
+ //TODO: Add a test to verify SPI.
+
@Test
public void testIpSecServiceReserveSpi() throws Exception {
when(mMockNetd.ipSecAllocateSpi(anyInt(), anyString(), eq(mDestinationAddr), eq(TEST_SPI)))
@@ -257,6 +266,47 @@ public class IpSecServiceParameterizedTest {
config.setAuthentication(AUTH_ALGO);
}
+ private void addEncapSocketToIpSecConfig(int resourceId, IpSecConfig config) throws Exception {
+ config.setEncapType(IpSecTransform.ENCAP_ESPINUDP);
+ config.setEncapSocketResourceId(resourceId);
+ config.setEncapRemotePort(REMOTE_ENCAP_PORT);
+ }
+
+ private void verifyTransformNetdCalledForCreatingSA(
+ IpSecConfig config, IpSecTransformResponse resp) throws Exception {
+ verifyTransformNetdCalledForCreatingSA(config, resp, 0);
+ }
+
+ private void verifyTransformNetdCalledForCreatingSA(
+ IpSecConfig config, IpSecTransformResponse resp, int encapSocketPort) throws Exception {
+ IpSecAlgorithm auth = config.getAuthentication();
+ IpSecAlgorithm crypt = config.getEncryption();
+ IpSecAlgorithm authCrypt = config.getAuthenticatedEncryption();
+
+ verify(mMockNetd, times(1))
+ .ipSecAddSecurityAssociation(
+ eq(mUid),
+ eq(config.getMode()),
+ eq(config.getSourceAddress()),
+ eq(config.getDestinationAddress()),
+ eq((config.getNetwork() != null) ? config.getNetwork().netId : 0),
+ eq(TEST_SPI),
+ eq(0),
+ eq(0),
+ eq((auth != null) ? auth.getName() : ""),
+ eq((auth != null) ? auth.getKey() : new byte[] {}),
+ eq((auth != null) ? auth.getTruncationLengthBits() : 0),
+ eq((crypt != null) ? crypt.getName() : ""),
+ eq((crypt != null) ? crypt.getKey() : new byte[] {}),
+ eq((crypt != null) ? crypt.getTruncationLengthBits() : 0),
+ eq((authCrypt != null) ? authCrypt.getName() : ""),
+ eq((authCrypt != null) ? authCrypt.getKey() : new byte[] {}),
+ eq((authCrypt != null) ? authCrypt.getTruncationLengthBits() : 0),
+ eq(config.getEncapType()),
+ eq(encapSocketPort),
+ eq(config.getEncapRemotePort()));
+ }
+
@Test
public void testCreateTransform() throws Exception {
IpSecConfig ipSecConfig = new IpSecConfig();
@@ -267,28 +317,7 @@ public class IpSecServiceParameterizedTest {
mIpSecService.createTransform(ipSecConfig, new Binder(), "blessedPackage");
assertEquals(IpSecManager.Status.OK, createTransformResp.status);
- verify(mMockNetd)
- .ipSecAddSecurityAssociation(
- eq(mUid),
- anyInt(),
- anyString(),
- anyString(),
- anyInt(),
- eq(TEST_SPI),
- anyInt(),
- anyInt(),
- eq(IpSecAlgorithm.AUTH_HMAC_SHA256),
- eq(AUTH_KEY),
- anyInt(),
- eq(IpSecAlgorithm.CRYPT_AES_CBC),
- eq(CRYPT_KEY),
- anyInt(),
- eq(""),
- eq(new byte[] {}),
- eq(0),
- anyInt(),
- anyInt(),
- anyInt());
+ verifyTransformNetdCalledForCreatingSA(ipSecConfig, createTransformResp);
}
@Test
@@ -302,28 +331,59 @@ public class IpSecServiceParameterizedTest {
mIpSecService.createTransform(ipSecConfig, new Binder(), "blessedPackage");
assertEquals(IpSecManager.Status.OK, createTransformResp.status);
- verify(mMockNetd)
- .ipSecAddSecurityAssociation(
- eq(mUid),
- anyInt(),
- anyString(),
- anyString(),
- anyInt(),
- eq(TEST_SPI),
- anyInt(),
- anyInt(),
- eq(""),
- eq(new byte[] {}),
- eq(0),
- eq(""),
- eq(new byte[] {}),
- eq(0),
- eq(IpSecAlgorithm.AUTH_CRYPT_AES_GCM),
- eq(AEAD_KEY),
- anyInt(),
- anyInt(),
- anyInt(),
- anyInt());
+ verifyTransformNetdCalledForCreatingSA(ipSecConfig, createTransformResp);
+ }
+
+ @Test
+ public void testCreateTransportModeTransformWithEncap() throws Exception {
+ IpSecUdpEncapResponse udpSock = mIpSecService.openUdpEncapsulationSocket(0, new Binder());
+
+ IpSecConfig ipSecConfig = new IpSecConfig();
+ ipSecConfig.setMode(IpSecTransform.MODE_TRANSPORT);
+ addDefaultSpisAndRemoteAddrToIpSecConfig(ipSecConfig);
+ addAuthAndCryptToIpSecConfig(ipSecConfig);
+ addEncapSocketToIpSecConfig(udpSock.resourceId, ipSecConfig);
+
+ if (mFamily == AF_INET) {
+ IpSecTransformResponse createTransformResp =
+ mIpSecService.createTransform(ipSecConfig, new Binder(), "blessedPackage");
+ assertEquals(IpSecManager.Status.OK, createTransformResp.status);
+
+ verifyTransformNetdCalledForCreatingSA(ipSecConfig, createTransformResp, udpSock.port);
+ } else {
+ try {
+ IpSecTransformResponse createTransformResp =
+ mIpSecService.createTransform(ipSecConfig, new Binder(), "blessedPackage");
+ fail("Expected IllegalArgumentException on attempt to use UDP Encap in IPv6");
+ } catch (IllegalArgumentException expected) {
+ }
+ }
+ }
+
+ @Test
+ public void testCreateTunnelModeTransformWithEncap() throws Exception {
+ IpSecUdpEncapResponse udpSock = mIpSecService.openUdpEncapsulationSocket(0, new Binder());
+
+ IpSecConfig ipSecConfig = new IpSecConfig();
+ ipSecConfig.setMode(IpSecTransform.MODE_TUNNEL);
+ addDefaultSpisAndRemoteAddrToIpSecConfig(ipSecConfig);
+ addAuthAndCryptToIpSecConfig(ipSecConfig);
+ addEncapSocketToIpSecConfig(udpSock.resourceId, ipSecConfig);
+
+ if (mFamily == AF_INET) {
+ IpSecTransformResponse createTransformResp =
+ mIpSecService.createTransform(ipSecConfig, new Binder(), "blessedPackage");
+ assertEquals(IpSecManager.Status.OK, createTransformResp.status);
+
+ verifyTransformNetdCalledForCreatingSA(ipSecConfig, createTransformResp, udpSock.port);
+ } else {
+ try {
+ IpSecTransformResponse createTransformResp =
+ mIpSecService.createTransform(ipSecConfig, new Binder(), "blessedPackage");
+ fail("Expected IllegalArgumentException on attempt to use UDP Encap in IPv6");
+ } catch (IllegalArgumentException expected) {
+ }
+ }
}
@Test