Only allow admin users to adopt sd card as internal storage.

Bug: 21883016
Change-Id: I11ca324ab74ce2a8bf13064b4c7735aea132c562
This commit is contained in:
Amith Yamasani
2015-06-30 14:23:54 -07:00
parent 21e00f9819
commit 350274040e
2 changed files with 20 additions and 2 deletions

View File

@@ -18,6 +18,7 @@ package com.android.settings.deviceinfo;
import android.content.Intent;
import android.os.Bundle;
import android.os.UserManager;
import android.os.storage.DiskInfo;
import android.os.storage.VolumeInfo;
import android.widget.CompoundButton;
@@ -30,6 +31,8 @@ public class StorageWizardInit extends StorageWizardBase {
private RadioButton mRadioExternal;
private RadioButton mRadioInternal;
private boolean mIsPermittedToAdopt;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -39,6 +42,8 @@ public class StorageWizardInit extends StorageWizardBase {
}
setContentView(R.layout.storage_wizard_init);
mIsPermittedToAdopt = UserManager.get(this).isAdminUser();
setIllustrationInternal(true);
setHeaderText(R.string.storage_wizard_init_title, mDisk.getDescription());
@@ -63,6 +68,12 @@ public class StorageWizardInit extends StorageWizardBase {
onNavigateNext();
finish();
}
// TODO: Show a message about why this is disabled for guest and that only an admin user
// can adopt an sd card.
if (!mIsPermittedToAdopt) {
mRadioInternal.setEnabled(false);
}
}
private final OnCheckedChangeListener mRadioListener = new OnCheckedChangeListener() {