mirror of https://github.com/M66B/NetGuard.git
parent
98b0ee7a3a
commit
3fffd41032
|
@ -19,6 +19,8 @@ package eu.faircode.netguard;
|
|||
Copyright 2015 by Marcel Bokhorst (M66B)
|
||||
*/
|
||||
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
|
@ -127,7 +129,17 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere
|
|||
else if ("manage_system".equals(name))
|
||||
SinkholeService.reload(null, this);
|
||||
|
||||
else if ("dark_theme".equals(name))
|
||||
else if ("credentials".equals(name)) {
|
||||
ComponentName component = new ComponentName(this, DeviceAdministratorReceiver.class);
|
||||
DevicePolicyManager dpm = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
|
||||
if (prefs.getBoolean(name, false) && !dpm.isAdminActive(component)) {
|
||||
Intent intent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN);
|
||||
intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, component);
|
||||
if (intent.resolveActivity(getPackageManager()) != null)
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
} else if ("dark_theme".equals(name))
|
||||
recreate();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue