Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 39e64e76 authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

API council: don't allow admin add from new task.

Change-Id: I45f75f8e2c43ba0dae51d37e104d18d0b1a2cdbf
parent 449708b1
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.app.admin.DevicePolicyManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
@@ -81,6 +82,12 @@ public class DeviceAdminAdd extends Activity {
        
        mDPM = (DevicePolicyManager)getSystemService(Context.DEVICE_POLICY_SERVICE);

        if ((getIntent().getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) != 0) {
            Log.w(TAG, "Can now start ADD_DEVICE_ADMIN as a new task");
            finish();
            return;
        }
        
        ComponentName cn = (ComponentName)getIntent().getParcelableExtra(
                DevicePolicyManager.EXTRA_DEVICE_ADMIN);
        if (cn == null) {