display amount of storage on /sdcard by downloads, music etc
when music storage usage is clicked on, show music app when downloads storage usage is clicked on, show download app when pic/videos storage usage is clicked on, show gallery app Change-Id: Ia1c341013e550acb537e6f8a4f4558030888cc45
This commit is contained in:
102
src/com/android/settings/deviceinfo/Constants.java
Normal file
102
src/com/android/settings/deviceinfo/Constants.java
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (C) 2010 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.
|
||||
*/
|
||||
package com.android.settings.deviceinfo;
|
||||
|
||||
import android.os.Environment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Some of the constants used in this package
|
||||
*/
|
||||
class Constants {
|
||||
static final int MEDIA_INDEX = 0;
|
||||
static final int DOWNLOADS_INDEX = 1;
|
||||
static final int PIC_VIDEO_INDEX = 2;
|
||||
static final int MUSIC_INDEX = 3;
|
||||
static final int MEDIA_APPS_DATA_INDEX = 4;
|
||||
static final int MEDIA_MISC_INDEX = 5;
|
||||
static final int NUM_MEDIA_DIRS_TRACKED = MEDIA_MISC_INDEX + 1;
|
||||
|
||||
static class MediaDirectory {
|
||||
final String[] mDirPaths;
|
||||
final String mKey;
|
||||
final String mPreferenceName;
|
||||
MediaDirectory(String pref, String debugInfo, String... paths) {
|
||||
mDirPaths = paths;
|
||||
mKey = debugInfo;
|
||||
mPreferenceName = pref;
|
||||
}
|
||||
}
|
||||
static final ArrayList<MediaDirectory> mMediaDirs = new ArrayList<MediaDirectory>();
|
||||
static final List<String> ExclusionTargetsForMiscFiles = new ArrayList<String>();
|
||||
static {
|
||||
mMediaDirs.add(MEDIA_INDEX,
|
||||
new MediaDirectory(null,
|
||||
"/sdcard",
|
||||
Environment.getExternalStorageDirectory().getAbsolutePath()));
|
||||
mMediaDirs.add(DOWNLOADS_INDEX,
|
||||
new MediaDirectory("memory_internal_downloads",
|
||||
"/sdcard/download",
|
||||
Environment.getExternalStoragePublicDirectory(
|
||||
Environment.DIRECTORY_DOWNLOADS).getAbsolutePath()));
|
||||
mMediaDirs.add(PIC_VIDEO_INDEX,
|
||||
new MediaDirectory("memory_internal_dcim",
|
||||
"/sdcard/pic_video",
|
||||
Environment.getExternalStoragePublicDirectory(
|
||||
Environment.DIRECTORY_DCIM).getAbsolutePath(),
|
||||
Environment.getExternalStoragePublicDirectory(
|
||||
Environment.DIRECTORY_MOVIES).getAbsolutePath(),
|
||||
Environment.getExternalStoragePublicDirectory(
|
||||
Environment.DIRECTORY_PICTURES).getAbsolutePath()));
|
||||
mMediaDirs.add(MUSIC_INDEX,
|
||||
new MediaDirectory("memory_internal_music",
|
||||
"/sdcard/audio",
|
||||
Environment.getExternalStoragePublicDirectory(
|
||||
Environment.DIRECTORY_MUSIC).getAbsolutePath(),
|
||||
Environment.getExternalStoragePublicDirectory(
|
||||
Environment.DIRECTORY_ALARMS).getAbsolutePath(),
|
||||
Environment.getExternalStoragePublicDirectory(
|
||||
Environment.DIRECTORY_NOTIFICATIONS).getAbsolutePath(),
|
||||
Environment.getExternalStoragePublicDirectory(
|
||||
Environment.DIRECTORY_RINGTONES).getAbsolutePath(),
|
||||
Environment.getExternalStoragePublicDirectory(
|
||||
Environment.DIRECTORY_PODCASTS).getAbsolutePath()));
|
||||
mMediaDirs.add(MEDIA_APPS_DATA_INDEX,
|
||||
new MediaDirectory(null,
|
||||
"/sdcard/Android",
|
||||
Environment.getExternalStorageAndroidDataDir().getAbsolutePath()));
|
||||
mMediaDirs.add(MEDIA_MISC_INDEX,
|
||||
new MediaDirectory("memory_internal_media_misc",
|
||||
"misc on /sdcard",
|
||||
"not relevant"));
|
||||
// prepare a lit of strings representing dirpaths that should be skipped while looking
|
||||
// for 'other' files
|
||||
for (int j = 0; j < Constants.NUM_MEDIA_DIRS_TRACKED - 1; j++) {
|
||||
String[] dirs = Constants.mMediaDirs.get(j).mDirPaths;
|
||||
int len = dirs.length;
|
||||
if (len > 0) {
|
||||
for (int k = 0; k < len; k++) {
|
||||
ExclusionTargetsForMiscFiles.add(dirs[k]);
|
||||
}
|
||||
}
|
||||
// also add /sdcard/Android
|
||||
ExclusionTargetsForMiscFiles.add(
|
||||
Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user