Logging SetNewPasswordActivity events

Every launch of the activity with either ACTION_SET_NEW_PASSWORD
or ACTION_SET_NEW_PARENT_PROFILE_PASSWORD is logged, regardless
of whether extra EXTRA_PASSWORD_COMPLEXITY is used or whether
the caller has the required permisssion or not
- action: ACTION_SET_NEW_PASSWORD or
ACTION_SET_NEW_PARENT_PROFILE_PASSWORD
- pageId: SET_NEW_PASSWORD_ACTIVITY
- key: calling app package name
- value: raw value of intent extra EXTRA_PASSWORD_COMPLEXITY, or
Integer.MIN_VALUE if it does not exist

Bug: 120840632
Test: atest packages/apps/Settings/tests/robotests/src/com/android/settings/password/PasswordUtilsTest.java
      atest packages/apps/Settings/tests/robotests/src/com/android/settings/password/SetNewPasswordActivityTest.java
Change-Id: I57dc55110f7f284ddad7d3fc971d1f2298b46cbd
This commit is contained in:
Bernard Chau
2019-01-29 18:28:13 +00:00
parent 09c932b2b9
commit 00870bff0d
5 changed files with 176 additions and 9 deletions

View File

@@ -68,7 +68,7 @@ public final class PasswordUtils extends com.android.settingslib.Utils {
* Returns the package name which the activity with {@code activityToken} is launched from.
*/
@Nullable
private static String getCallingAppPackageName(IBinder activityToken) {
public static String getCallingAppPackageName(IBinder activityToken) {
String pkg = null;
try {
pkg = ActivityManager.getService().getLaunchedFromPackage(activityToken);