Skip to content

Commit

Permalink
Checkpoint of new storage UI.
Browse files Browse the repository at this point in the history
Top-level storage UI now shows list of all devices, both internal
and adopted/private volumes, and public/shared volumes.

When viewing a private volume, show traditional clustering of data
types, including summary of other users.  For adopted volumes, any
actions are tucked away in a menu, since they're not primary.  Misc
files browsing is now provided by DocumentsUI.

Teach StorageMeasurement about new private volumes, including
handling emulated volumes stacked above them.  When measuring, only
consider apps actually hosted on the current volume UUID.

When viewing a public volume, we default to launching into file
management mode, and offer a simple eject button at the top-level
view.  File management mode is offered by new DocumentsUI browse
intent, and a Settings link there redirects back to us for actual
operations like ejecting/formatting.  When unmounted, we launch
into our action view.

Actions like ejecting/formatting just show simple toasts for now.

Bug: 19993667
Change-Id: Ie990ef3c01fb3717aaf8c79bfc53aac7edefdcf7
  • Loading branch information
jsharkey committed Apr 13, 2015
1 parent 09c0c13 commit 42833b2
Show file tree
Hide file tree
Showing 20 changed files with 1,561 additions and 1,498 deletions.
22 changes: 19 additions & 3 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1415,15 +1415,31 @@
<category android:name="android.intent.category.VOICE_LAUNCH" />
</intent-filter>
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.deviceinfo.Memory" />
android:value="com.android.settings.deviceinfo.StorageSettings" />
<meta-data android:name="com.android.settings.TOP_LEVEL_HEADER_ID"
android:resource="@id/storage_settings" />
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
android:value="true" />
</activity>

<activity android:name=".deviceinfo.MiscFilesHandler"
android:theme="@style/Theme.SubSettingsDialogWhenLarge"/>
<activity
android:name="Settings$StorageVolumeSettingsActivity"
android:label="@string/storage_settings_title"
android:taskAffinity="com.android.settings"
android:parentActivityName="Settings$StorageSettingsActivity">
<intent-filter>
<action android:name="android.provider.action.DOCUMENT_ROOT_SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:scheme="content"
android:host="com.android.externalstorage.documents"
android:mimeType="vnd.android.document/root" />
</intent-filter>
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.deviceinfo.PublicVolumeSettings" />
<meta-data android:name="com.android.settings.TOP_LEVEL_HEADER_ID"
android:resource="@id/storage_settings" />
</activity>

<activity android:name="ApnEditor"
android:label="@string/apn_edit">
Expand Down
47 changes: 47 additions & 0 deletions res/layout/preference_storage_action.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">

<TextView
android:id="@+id/unmount"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:paddingStart="16dip"
android:paddingEnd="16dip"
android:contentDescription="@string/storage_menu_unmount"
android:layout_gravity="center"
android:gravity="center"
android:textSize="30sp"
android:background="?android:attr/selectableItemBackground" />

<!--
<ImageView
android:id="@+id/eject"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:paddingStart="16dip"
android:paddingEnd="16dip"
android:src="@drawable/ic_sync_green_holo"
android:contentDescription="@string/storage_menu_eject"
android:layout_gravity="center"
android:background="?android:attr/selectableItemBackground" />
-->
</LinearLayout>
33 changes: 33 additions & 0 deletions res/menu/storage_volume.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2012 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/storage_rename"
android:title="@string/storage_menu_rename" />
<item
android:id="@+id/storage_mount"
android:title="@string/storage_menu_mount" />
<item
android:id="@+id/storage_unmount"
android:title="@string/storage_menu_unmount" />
<item
android:id="@+id/storage_format"
android:title="@string/storage_menu_format" />
<item
android:id="@+id/storage_usb"
android:title="@string/storage_menu_usb" />
</menu>
43 changes: 41 additions & 2 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,9 @@
<!-- Button label for generic forget action [CHAR LIMIT=20] -->
<string name="forget">Forget</string>

<!-- Button label for generic save action [CHAR LIMIT=20] -->
<string name="save">Save</string>

<!-- Title of the Settings activity shown within the application itself. -->
<string name="settings_label">Settings</string>
<!-- Title of the Settings activity shown in the Launcher. [CHAR LIMIT=20] -->
Expand Down Expand Up @@ -2185,7 +2188,7 @@
<!-- SD card & phone storage settings summary. Displayed when the total memory usage is being calculated. Will be replaced with a number like "12.3 GB" when finished calucating. [CHAR LIMIT=30] -->
<string name="memory_calculating_size">Calculating\u2026</string>
<!-- SD card & phone storage settings title. Displayed as a title when showing the total usage of applications installed. Below it will be a number like "123.4 MB" indicating used storage. [CHAR LIMIT=50] -->
<string name="memory_apps_usage">Apps (app data &amp; media content)</string>
<string name="memory_apps_usage">Apps &amp; app data</string>
<!-- SD card & phone storage settings title. Displayed as a title when showing the total usage of media on the device. Below it will be a number like "123.4 MB" indicating used storage. [CHAR LIMIT=50] -->
<string name="memory_media_usage">Media</string>
<!-- SD card & phone storage settings title. Displayed as a title when showing the total usage of /sdcard/Download on the device. Below it will be a number like "123.4 MB" indicating used storage. [CHAR LIMIT=50] -->
Expand All @@ -2195,7 +2198,7 @@
<!-- SD card & phone storage settings title. Displayed as a title when showing the total usage of audio files in /sdcard on the device. Below it will be a number like "123.4 MB" indicating used storage. [CHAR LIMIT=50] -->
<string name="memory_music_usage">Audio (music, ringtones, podcasts, etc.)</string>
<!-- SD card & phone storage settings title. Displayed as a title when showing the total usage of misc files on the device. Below it will be a number like "123.4 MB" indicating used storage. [CHAR LIMIT=50] -->
<string name="memory_media_misc_usage">Misc.</string>
<string name="memory_media_misc_usage">Other files</string>
<!-- Storage item representing all cached data on device. [CHAR LIMIT=48] -->
<string name="memory_media_cache_usage">Cached data</string>
<!-- SD card & phone storage settings item title that will result in the phone unmounting the SD card. This will be done before the user phyiscally removes the SD card from the phone. Kind of like the "Safely remove" on some operating systems. [CHAR LIMIT=25] -->
Expand Down Expand Up @@ -2270,6 +2273,16 @@
<!-- Settings item summary when storage is running low [CHAR LIMIT=NONE] -->
<string name="storage_low_summary">Some system functions, such as syncing, may not work correctly. Try to free space by deleting or unpinning items, such as apps or media content.</string>

<!-- Storage setting. Menu option for renaming a storage device [CHAR LIMIT=30]-->
<string name="storage_menu_rename">Rename</string>
<!-- Storage setting. Menu option for mounting a storage device [CHAR LIMIT=30]-->
<string name="storage_menu_mount">Mount</string>
<!-- Storage setting. Menu option for unmounting a storage device [CHAR LIMIT=30]-->
<string name="storage_menu_unmount">Eject</string>
<!-- Storage setting. Menu option for erasing and formatting a storage device [CHAR LIMIT=30]-->
<string name="storage_menu_format">Erase &amp; format</string>
<!-- Storage setting. Menu option for erasing and formatting a storage device [CHAR LIMIT=30]-->
<string name="storage_menu_format_internal">Erase &amp; format as internal storage</string>
<!-- Storage setting. Menu option for USB transfer settings [CHAR LIMIT=30]-->
<string name="storage_menu_usb">USB computer connection</string>

Expand All @@ -2293,6 +2306,32 @@
<!-- Section header above list of other users storage [CHAR LIMIT=32] -->
<string name="storage_other_users">Other users</string>

<!-- Section header above list of internal storage devices [CHAR LIMIT=30]-->
<string name="storage_internal_title">Device storage</string>
<!-- Section header above list of external storage devices [CHAR LIMIT=30]-->
<string name="storage_external_title">Removable storage</string>

<!-- Summary of a single storage volume, constrasting available and total storage space. [CHAR LIMIT=48]-->
<string name="storage_volume_summary"><xliff:g id="free" example="1.2GB">%1$s</xliff:g> free (Total <xliff:g id="total" example="32GB">%2$s</xliff:g>)</string>

<!-- Toast informing that storage mount operation was successful. [CHAR LIMIT=64]-->
<string name="storage_mount_success"><xliff:g id="name" example="SD card">%1$s</xliff:g> is mounted</string>
<!-- Toast informing that storage unmount operation failed. [CHAR LIMIT=64]-->
<string name="storage_mount_failure">Couldn\'t mount <xliff:g id="name" example="SD card">%1$s</xliff:g></string>

<!-- Toast informing that storage unmount operation was successful. [CHAR LIMIT=64]-->
<string name="storage_unmount_success"><xliff:g id="name" example="SD card">%1$s</xliff:g> is safely ejected</string>
<!-- Toast informing that storage unmount operation failed. [CHAR LIMIT=64]-->
<string name="storage_unmount_failure">Couldn\'t safely eject <xliff:g id="name" example="SD card">%1$s</xliff:g></string>

<!-- Toast informing that storage format operation was successful. [CHAR LIMIT=64]-->
<string name="storage_format_success"><xliff:g id="name" example="SD card">%1$s</xliff:g> is formatted</string>
<!-- Toast informing that storage format operation failed. [CHAR LIMIT=64]-->
<string name="storage_format_failure">Couldn\'t format <xliff:g id="name" example="SD card">%1$s</xliff:g></string>

<!-- Title of dialog prompting user to rename a storage volume [CHAR LIMIT=32]-->
<string name="storage_rename_title">Rename storage</string>

<!-- Phone info screen, section titles: -->
<string name="battery_status_title">Battery status</string>
<!-- Phone info screen, section titles: -->
Expand Down
2 changes: 1 addition & 1 deletion res/xml/dashboard_categories.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
<dashboard-tile
android:id="@+id/storage_settings"
android:title="@string/storage_settings"
android:fragment="com.android.settings.deviceinfo.Memory"
android:fragment="com.android.settings.deviceinfo.StorageSettings"
android:icon="@drawable/ic_settings_storage"
/>

Expand Down
31 changes: 31 additions & 0 deletions res/xml/device_info_storage.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
android:title="@string/storage_settings"
settings:keywords="@string/keywords_storage">

<PreferenceCategory
android:key="storage_internal"
android:title="@string/storage_internal_title" />

<PreferenceCategory
android:key="storage_external"
android:title="@string/storage_external_title" />

</PreferenceScreen>
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,20 @@
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
android:title="@string/storage_settings"
settings:keywords="@string/keywords_storage">

<!-- Preference categories are dynamically created based on the list of available storage volumes -->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
android:title="@string/storage_settings"
settings:keywords="@string/keywords_storage">

</PreferenceScreen>
1 change: 1 addition & 0 deletions src/com/android/settings/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public static class TetherSettingsActivity extends SettingsActivity { /* empty *
public static class VpnSettingsActivity extends SettingsActivity { /* empty */ }
public static class DateTimeSettingsActivity extends SettingsActivity { /* empty */ }
public static class StorageSettingsActivity extends SettingsActivity { /* empty */ }
public static class StorageVolumeSettingsActivity extends SettingsActivity { /* empty */ }
public static class WifiSettingsActivity extends SettingsActivity { /* empty */ }
public static class WifiP2pSettingsActivity extends SettingsActivity { /* empty */ }
public static class InputMethodAndLanguageSettingsActivity extends SettingsActivity { /* empty */ }
Expand Down
6 changes: 4 additions & 2 deletions src/com/android/settings/SettingsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@
import com.android.settings.dashboard.DashboardTile;
import com.android.settings.dashboard.NoHomeDialogFragment;
import com.android.settings.dashboard.SearchResultsSummary;
import com.android.settings.deviceinfo.Memory;
import com.android.settings.deviceinfo.PublicVolumeSettings;
import com.android.settings.deviceinfo.StorageSettings;
import com.android.settings.deviceinfo.UsbSettings;
import com.android.settings.fuelgauge.BatterySaverSettings;
import com.android.settings.fuelgauge.PowerUsageSummary;
Expand Down Expand Up @@ -305,7 +306,8 @@ public class SettingsActivity extends Activity
CaptionPropertiesFragment.class.getName(),
com.android.settings.accessibility.ToggleDaltonizerPreferenceFragment.class.getName(),
TextToSpeechSettings.class.getName(),
Memory.class.getName(),
StorageSettings.class.getName(),
PublicVolumeSettings.class.getName(),
DevelopmentSettings.class.getName(),
UsbSettings.class.getName(),
AndroidBeam.class.getName(),
Expand Down

0 comments on commit 42833b2

Please sign in to comment.