diff --git a/src/com/android/settings/DeviceAdminAdd.java b/src/com/android/settings/DeviceAdminAdd.java index 62340380051..8bfdf927cad 100644 --- a/src/com/android/settings/DeviceAdminAdd.java +++ b/src/com/android/settings/DeviceAdminAdd.java @@ -38,6 +38,7 @@ import android.os.Handler; import android.os.RemoteCallback; import android.os.RemoteException; import android.text.TextUtils.TruncateAt; +import android.util.EventLog; import android.util.Log; import android.view.Display; import android.view.View; @@ -55,19 +56,19 @@ import java.util.List; public class DeviceAdminAdd extends Activity { static final String TAG = "DeviceAdminAdd"; - + static final int DIALOG_WARNING = 1; private static final int MAX_ADD_MSG_LINES_PORTRAIT = 5; private static final int MAX_ADD_MSG_LINES_LANDSCAPE = 2; private static final int MAX_ADD_MSG_LINES = 15; - + Handler mHandler; - + DevicePolicyManager mDPM; DeviceAdminInfo mDeviceAdmin; CharSequence mAddMsgText; - + ImageView mAdminIcon; TextView mAdminName; TextView mAdminDescription; @@ -78,19 +79,19 @@ public class DeviceAdminAdd extends Activity { ViewGroup mAdminPolicies; Button mActionButton; Button mCancelButton; - + final ArrayList mAddingPolicies = new ArrayList(); final ArrayList mActivePolicies = new ArrayList(); - + boolean mAdding; boolean mRefreshing; - + @Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); mHandler = new Handler(getMainLooper()); - + mDPM = (DevicePolicyManager)getSystemService(Context.DEVICE_POLICY_SERVICE); if ((getIntent().getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) != 0) { @@ -98,7 +99,7 @@ public class DeviceAdminAdd extends Activity { finish(); return; } - + ComponentName cn = (ComponentName)getIntent().getParcelableExtra( DevicePolicyManager.EXTRA_DEVICE_ADMIN); if (cn == null) { @@ -163,7 +164,7 @@ public class DeviceAdminAdd extends Activity { finish(); return; } - + // This admin already exists, an we have two options at this point. If new policy // bits are set, show the user the new list. If nothing has changed, simply return // "OK" immediately. @@ -189,7 +190,7 @@ public class DeviceAdminAdd extends Activity { mAddMsgText = getIntent().getCharSequenceExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION); setContentView(R.layout.device_admin_add); - + mAdminIcon = (ImageView)findViewById(R.id.admin_icon); mAdminName = (TextView)findViewById(R.id.admin_name); mAdminDescription = (TextView)findViewById(R.id.admin_description); @@ -210,6 +211,8 @@ public class DeviceAdminAdd extends Activity { mCancelButton = (Button) findViewById(R.id.cancel_button); mCancelButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { + EventLog.writeEvent(EventLogTags.EXP_DET_DEVICE_ADMIN_DECLINED_BY_USER, + mDeviceAdmin.getActivityInfo().applicationInfo.uid); finish(); } }); @@ -220,6 +223,8 @@ public class DeviceAdminAdd extends Activity { try { mDPM.setActiveAdmin(mDeviceAdmin.getComponent(), mRefreshing); setResult(Activity.RESULT_OK); + EventLog.writeEvent(EventLogTags.EXP_DET_DEVICE_ADMIN_ACTIVATED_BY_USER, + mDeviceAdmin.getActivityInfo().applicationInfo.uid); } catch (RuntimeException e) { // Something bad happened... could be that it was // already set, though. @@ -264,13 +269,13 @@ public class DeviceAdminAdd extends Activity { } }); } - + @Override protected void onResume() { super.onResume(); updateInterface(); } - + @Override protected Dialog onCreateDialog(int id, Bundle args) { switch (id) { @@ -291,17 +296,17 @@ public class DeviceAdminAdd extends Activity { } default: return super.onCreateDialog(id, args); - + } } - + static void setViewVisibility(ArrayList views, int visibility) { final int N = views.size(); for (int i=0; i