Initial screens for Storage Access.

This new settings will be accessed through Apps -> Special Apps and it will let
users change the status of granted (or denied) Scoped Access Permissions.

This initial CL implements the landing activity that shows all packages and an
initial version of the detailed activity for a specific page, althouth the
detailed activity is not ready yet.

Test: manual verification
Test: export ROBOTEST_FILTER=com.android.settings.core.codeinspection.CodeInspectionTest && make RunSettingsRoboTests -j40
Bug: 63720392

Change-Id: Id0419c2c4aaaec365803218d6947e230e4776f13
This commit is contained in:
Felipe Leme
2018-01-12 13:00:24 -08:00
parent 0fea51b343
commit 7a0ad2b30f
9 changed files with 250 additions and 4 deletions

View File

@@ -84,6 +84,7 @@ import com.android.settings.applications.AppStateInstallAppsBridge;
import com.android.settings.applications.AppStateNotificationBridge;
import com.android.settings.applications.AppStateOverlayBridge;
import com.android.settings.applications.AppStatePowerBridge;
import com.android.settings.applications.AppStateStorageAccessBridge;
import com.android.settings.applications.AppStateUsageBridge;
import com.android.settings.applications.AppStateUsageBridge.UsageState;
import com.android.settings.applications.AppStateWriteSettingsBridge;
@@ -92,6 +93,7 @@ import com.android.settings.applications.DefaultAppSettings;
import com.android.settings.applications.InstalledAppCounter;
import com.android.settings.applications.InstalledAppDetails;
import com.android.settings.applications.NotificationApps;
import com.android.settings.applications.StorageAccessDetails;
import com.android.settings.applications.UsageAccessDetails;
import com.android.settings.applications.appinfo.AppInfoDashboardFragment;
import com.android.settings.applications.appinfo.DrawOverlayDetails;
@@ -204,6 +206,7 @@ public class ManageApplications extends InstrumentedPreferenceFragment
public static final int LIST_TYPE_GAMES = 9;
public static final int LIST_TYPE_MOVIES = 10;
public static final int LIST_TYPE_PHOTOGRAPHY = 11;
public static final int LIST_TYPE_STORAGE_ACCESS = 12;
// List types that should show instant apps.
public static final Set<Integer> LIST_TYPES_WITH_INSTANT = new ArraySet<>(Arrays.asList(
@@ -279,6 +282,9 @@ public class ManageApplications extends InstrumentedPreferenceFragment
mListType = LIST_TYPE_PHOTOGRAPHY;
mSortOrder = R.id.sort_order_size;
mStorageType = args.getInt(EXTRA_STORAGE_TYPE, STORAGE_TYPE_DEFAULT);
} else if (className.equals(Settings.StorageAccessSettingsActivity.class.getName())) {
mListType = LIST_TYPE_STORAGE_ACCESS;
screenTitle = R.string.storage_access;
} else {
mListType = LIST_TYPE_MAIN;
}
@@ -443,6 +449,8 @@ public class ManageApplications extends InstrumentedPreferenceFragment
return MetricsEvent.SYSTEM_ALERT_WINDOW_APPS;
case LIST_TYPE_MANAGE_SOURCES:
return MetricsEvent.MANAGE_EXTERNAL_SOURCES;
case LIST_TYPE_STORAGE_ACCESS:
return MetricsEvent.STORAGE_ACCESS;
default:
return MetricsEvent.VIEW_UNKNOWN;
}
@@ -537,6 +545,10 @@ public class ManageApplications extends InstrumentedPreferenceFragment
case LIST_TYPE_PHOTOGRAPHY:
startAppInfoFragment(AppStorageSettings.class, R.string.storage_photos_videos);
break;
case LIST_TYPE_STORAGE_ACCESS:
startAppInfoFragment(StorageAccessDetails.class, R.string.storage_access);
break;
// TODO: Figure out if there is a way where we can spin up the profile's settings
// process ahead of time, to avoid a long load of data when user clicks on a managed
// app. Maybe when they load the list of apps that contains managed profile apps.
@@ -840,6 +852,8 @@ public class ManageApplications extends InstrumentedPreferenceFragment
mExtraInfoBridge = new AppStateWriteSettingsBridge(mContext, mState, this);
} else if (mManageApplications.mListType == LIST_TYPE_MANAGE_SOURCES) {
mExtraInfoBridge = new AppStateInstallAppsBridge(mContext, mState, this);
} else if (mManageApplications.mListType == LIST_TYPE_STORAGE_ACCESS) {
mExtraInfoBridge = new AppStateStorageAccessBridge(mState, this);
} else {
mExtraInfoBridge = null;
}
@@ -1241,6 +1255,9 @@ public class ManageApplications extends InstrumentedPreferenceFragment
case LIST_TYPE_MANAGE_SOURCES:
holder.setSummary(ExternalSourcesDetails.getPreferenceSummary(mContext, entry));
break;
case LIST_TYPE_STORAGE_ACCESS:
holder.setSummary(null);
break;
default:
holder.updateSizeText(entry, mManageApplications.mInvalidSizeStr, mWhichSize);
break;