Add event logging for device admin.

This allows us to gather metrics about unwanted device admin apps. User consent from Verify Apps is required.

Bug: 11253927
Change-Id: I449929772f63f426426f7726d3d21e7c1512e6ce
This commit is contained in:
William Luh
2013-11-22 15:42:40 -08:00
parent c384651a2b
commit 64e676a586
2 changed files with 27 additions and 16 deletions

View File

@@ -38,6 +38,7 @@ import android.os.Handler;
import android.os.RemoteCallback; import android.os.RemoteCallback;
import android.os.RemoteException; import android.os.RemoteException;
import android.text.TextUtils.TruncateAt; import android.text.TextUtils.TruncateAt;
import android.util.EventLog;
import android.util.Log; import android.util.Log;
import android.view.Display; import android.view.Display;
import android.view.View; import android.view.View;
@@ -210,6 +211,8 @@ public class DeviceAdminAdd extends Activity {
mCancelButton = (Button) findViewById(R.id.cancel_button); mCancelButton = (Button) findViewById(R.id.cancel_button);
mCancelButton.setOnClickListener(new View.OnClickListener() { mCancelButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) { public void onClick(View v) {
EventLog.writeEvent(EventLogTags.EXP_DET_DEVICE_ADMIN_DECLINED_BY_USER,
mDeviceAdmin.getActivityInfo().applicationInfo.uid);
finish(); finish();
} }
}); });
@@ -220,6 +223,8 @@ public class DeviceAdminAdd extends Activity {
try { try {
mDPM.setActiveAdmin(mDeviceAdmin.getComponent(), mRefreshing); mDPM.setActiveAdmin(mDeviceAdmin.getComponent(), mRefreshing);
setResult(Activity.RESULT_OK); setResult(Activity.RESULT_OK);
EventLog.writeEvent(EventLogTags.EXP_DET_DEVICE_ADMIN_ACTIVATED_BY_USER,
mDeviceAdmin.getActivityInfo().applicationInfo.uid);
} catch (RuntimeException e) { } catch (RuntimeException e) {
// Something bad happened... could be that it was // Something bad happened... could be that it was
// already set, though. // already set, though.

View File

@@ -4,3 +4,9 @@ option java_package com.android.settings
# log the type of screen lock when user sets lock screen # log the type of screen lock when user sets lock screen
90200 lock_screen_type (type|3) 90200 lock_screen_type (type|3)
# log whether user accepted and activated device admin
90201 exp_det_device_admin_activated_by_user (app_signature|3)
# log whether user declined activation of device admin
90202 exp_det_device_admin_declined_by_user (app_signature|3)