Search in sources :

Example 26 with DiskInfo

use of android.os.storage.DiskInfo in project android_frameworks_base by crdroidandroid.

the class MountService method dump.

@Override
protected void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
    mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG);
    final IndentingPrintWriter pw = new IndentingPrintWriter(writer, "  ", 160);
    synchronized (mLock) {
        pw.println("Disks:");
        pw.increaseIndent();
        for (int i = 0; i < mDisks.size(); i++) {
            final DiskInfo disk = mDisks.valueAt(i);
            disk.dump(pw);
        }
        pw.decreaseIndent();
        pw.println();
        pw.println("Volumes:");
        pw.increaseIndent();
        for (int i = 0; i < mVolumes.size(); i++) {
            final VolumeInfo vol = mVolumes.valueAt(i);
            if (VolumeInfo.ID_PRIVATE_INTERNAL.equals(vol.id))
                continue;
            vol.dump(pw);
        }
        pw.decreaseIndent();
        pw.println();
        pw.println("Records:");
        pw.increaseIndent();
        for (int i = 0; i < mRecords.size(); i++) {
            final VolumeRecord note = mRecords.valueAt(i);
            note.dump(pw);
        }
        pw.decreaseIndent();
        pw.println();
        pw.println("Primary storage UUID: " + mPrimaryStorageUuid);
        pw.println("Force adoptable: " + mForceAdoptable);
        pw.println();
        pw.println("Local unlocked users: " + Arrays.toString(mLocalUnlockedUsers));
        pw.println("System unlocked users: " + Arrays.toString(mSystemUnlockedUsers));
    }
    synchronized (mObbMounts) {
        pw.println();
        pw.println("mObbMounts:");
        pw.increaseIndent();
        final Iterator<Entry<IBinder, List<ObbState>>> binders = mObbMounts.entrySet().iterator();
        while (binders.hasNext()) {
            Entry<IBinder, List<ObbState>> e = binders.next();
            pw.println(e.getKey() + ":");
            pw.increaseIndent();
            final List<ObbState> obbStates = e.getValue();
            for (final ObbState obbState : obbStates) {
                pw.println(obbState);
            }
            pw.decreaseIndent();
        }
        pw.decreaseIndent();
        pw.println();
        pw.println("mObbPathToStateMap:");
        pw.increaseIndent();
        final Iterator<Entry<String, ObbState>> maps = mObbPathToStateMap.entrySet().iterator();
        while (maps.hasNext()) {
            final Entry<String, ObbState> e = maps.next();
            pw.print(e.getKey());
            pw.print(" -> ");
            pw.println(e.getValue());
        }
        pw.decreaseIndent();
    }
    pw.println();
    pw.println("mConnector:");
    pw.increaseIndent();
    mConnector.dump(fd, pw, args);
    pw.decreaseIndent();
    pw.println();
    pw.println("mCryptConnector:");
    pw.increaseIndent();
    mCryptConnector.dump(fd, pw, args);
    pw.decreaseIndent();
    pw.println();
    pw.print("Last maintenance: ");
    pw.println(TimeUtils.formatForLogging(mLastMaintenance));
}
Also used : DiskInfo(android.os.storage.DiskInfo) VolumeInfo(android.os.storage.VolumeInfo) VolumeRecord(android.os.storage.VolumeRecord) Entry(java.util.Map.Entry) IBinder(android.os.IBinder) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) ArrayList(java.util.ArrayList) RemoteCallbackList(android.os.RemoteCallbackList) List(java.util.List) LinkedList(java.util.LinkedList) IndentingPrintWriter(com.android.internal.util.IndentingPrintWriter)

Example 27 with DiskInfo

use of android.os.storage.DiskInfo in project platform_frameworks_base by android.

the class StorageNotification method onVolumeMounted.

private Notification onVolumeMounted(VolumeInfo vol) {
    final VolumeRecord rec = mStorageManager.findRecordByUuid(vol.getFsUuid());
    final DiskInfo disk = vol.getDisk();
    // used to allow snoozing non-adoptable disks too.)
    if (rec.isSnoozed() && disk.isAdoptable()) {
        return null;
    }
    if (disk.isAdoptable() && !rec.isInited()) {
        final CharSequence title = disk.getDescription();
        final CharSequence text = mContext.getString(R.string.ext_media_new_notification_message, disk.getDescription());
        final PendingIntent initIntent = buildInitPendingIntent(vol);
        return buildNotificationBuilder(vol, title, text).addAction(new Action(R.drawable.ic_settings_24dp, mContext.getString(R.string.ext_media_init_action), initIntent)).addAction(new Action(R.drawable.ic_eject_24dp, mContext.getString(R.string.ext_media_unmount_action), buildUnmountPendingIntent(vol))).setContentIntent(initIntent).setDeleteIntent(buildSnoozeIntent(vol.getFsUuid())).setCategory(Notification.CATEGORY_SYSTEM).build();
    } else {
        final CharSequence title = disk.getDescription();
        final CharSequence text = mContext.getString(R.string.ext_media_ready_notification_message, disk.getDescription());
        final PendingIntent browseIntent = buildBrowsePendingIntent(vol);
        final Notification.Builder builder = buildNotificationBuilder(vol, title, text).addAction(new Action(R.drawable.ic_folder_24dp, mContext.getString(R.string.ext_media_browse_action), browseIntent)).addAction(new Action(R.drawable.ic_eject_24dp, mContext.getString(R.string.ext_media_unmount_action), buildUnmountPendingIntent(vol))).setContentIntent(browseIntent).setCategory(Notification.CATEGORY_SYSTEM).setPriority(Notification.PRIORITY_LOW);
        // Non-adoptable disks can't be snoozed.
        if (disk.isAdoptable()) {
            builder.setDeleteIntent(buildSnoozeIntent(vol.getFsUuid()));
        }
        return builder.build();
    }
}
Also used : VolumeRecord(android.os.storage.VolumeRecord) Action(android.app.Notification.Action) DiskInfo(android.os.storage.DiskInfo) PendingIntent(android.app.PendingIntent) Notification(android.app.Notification)

Example 28 with DiskInfo

use of android.os.storage.DiskInfo in project platform_frameworks_base by android.

the class StorageNotification method onVolumeChecking.

private Notification onVolumeChecking(VolumeInfo vol) {
    final DiskInfo disk = vol.getDisk();
    final CharSequence title = mContext.getString(R.string.ext_media_checking_notification_title, disk.getDescription());
    final CharSequence text = mContext.getString(R.string.ext_media_checking_notification_message, disk.getDescription());
    return buildNotificationBuilder(vol, title, text).setCategory(Notification.CATEGORY_PROGRESS).setPriority(Notification.PRIORITY_LOW).setOngoing(true).build();
}
Also used : DiskInfo(android.os.storage.DiskInfo)

Example 29 with DiskInfo

use of android.os.storage.DiskInfo in project platform_frameworks_base by android.

the class MountService method dump.

@Override
protected void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
    mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG);
    final IndentingPrintWriter pw = new IndentingPrintWriter(writer, "  ", 160);
    synchronized (mLock) {
        pw.println("Disks:");
        pw.increaseIndent();
        for (int i = 0; i < mDisks.size(); i++) {
            final DiskInfo disk = mDisks.valueAt(i);
            disk.dump(pw);
        }
        pw.decreaseIndent();
        pw.println();
        pw.println("Volumes:");
        pw.increaseIndent();
        for (int i = 0; i < mVolumes.size(); i++) {
            final VolumeInfo vol = mVolumes.valueAt(i);
            if (VolumeInfo.ID_PRIVATE_INTERNAL.equals(vol.id))
                continue;
            vol.dump(pw);
        }
        pw.decreaseIndent();
        pw.println();
        pw.println("Records:");
        pw.increaseIndent();
        for (int i = 0; i < mRecords.size(); i++) {
            final VolumeRecord note = mRecords.valueAt(i);
            note.dump(pw);
        }
        pw.decreaseIndent();
        pw.println();
        pw.println("Primary storage UUID: " + mPrimaryStorageUuid);
        final Pair<String, Long> pair = StorageManager.getPrimaryStoragePathAndSize();
        if (pair == null) {
            pw.println("Internal storage total size: N/A");
        } else {
            pw.print("Internal storage (");
            pw.print(pair.first);
            pw.print(") total size: ");
            pw.print(pair.second);
            pw.print(" (");
            pw.print((float) pair.second / TrafficStats.GB_IN_BYTES);
            pw.println(" GB)");
        }
        pw.println("Force adoptable: " + mForceAdoptable);
        pw.println();
        pw.println("Local unlocked users: " + Arrays.toString(mLocalUnlockedUsers));
        pw.println("System unlocked users: " + Arrays.toString(mSystemUnlockedUsers));
    }
    synchronized (mObbMounts) {
        pw.println();
        pw.println("mObbMounts:");
        pw.increaseIndent();
        final Iterator<Entry<IBinder, List<ObbState>>> binders = mObbMounts.entrySet().iterator();
        while (binders.hasNext()) {
            Entry<IBinder, List<ObbState>> e = binders.next();
            pw.println(e.getKey() + ":");
            pw.increaseIndent();
            final List<ObbState> obbStates = e.getValue();
            for (final ObbState obbState : obbStates) {
                pw.println(obbState);
            }
            pw.decreaseIndent();
        }
        pw.decreaseIndent();
        pw.println();
        pw.println("mObbPathToStateMap:");
        pw.increaseIndent();
        final Iterator<Entry<String, ObbState>> maps = mObbPathToStateMap.entrySet().iterator();
        while (maps.hasNext()) {
            final Entry<String, ObbState> e = maps.next();
            pw.print(e.getKey());
            pw.print(" -> ");
            pw.println(e.getValue());
        }
        pw.decreaseIndent();
    }
    pw.println();
    pw.println("mConnector:");
    pw.increaseIndent();
    mConnector.dump(fd, pw, args);
    pw.decreaseIndent();
    pw.println();
    pw.println("mCryptConnector:");
    pw.increaseIndent();
    mCryptConnector.dump(fd, pw, args);
    pw.decreaseIndent();
    pw.println();
    pw.print("Last maintenance: ");
    pw.println(TimeUtils.formatForLogging(mLastMaintenance));
}
Also used : DiskInfo(android.os.storage.DiskInfo) VolumeInfo(android.os.storage.VolumeInfo) VolumeRecord(android.os.storage.VolumeRecord) Entry(java.util.Map.Entry) IBinder(android.os.IBinder) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) ArrayList(java.util.ArrayList) RemoteCallbackList(android.os.RemoteCallbackList) List(java.util.List) LinkedList(java.util.LinkedList) IndentingPrintWriter(com.android.internal.util.IndentingPrintWriter)

Example 30 with DiskInfo

use of android.os.storage.DiskInfo in project platform_frameworks_base by android.

the class Sm method runListDisks.

public void runListDisks() throws RemoteException {
    final boolean onlyAdoptable = "adoptable".equals(nextArg());
    final DiskInfo[] disks = mSm.getDisks();
    for (DiskInfo disk : disks) {
        if (!onlyAdoptable || disk.isAdoptable()) {
            System.out.println(disk.getId());
        }
    }
}
Also used : DiskInfo(android.os.storage.DiskInfo)

Aggregations

DiskInfo (android.os.storage.DiskInfo)51 VolumeInfo (android.os.storage.VolumeInfo)16 VolumeRecord (android.os.storage.VolumeRecord)11 File (java.io.File)6 Notification (android.app.Notification)5 Action (android.app.Notification.Action)5 NotificationManager (android.app.NotificationManager)5 PendingIntent (android.app.PendingIntent)5 IntentFilter (android.content.IntentFilter)5 Point (android.graphics.Point)5 Handler (android.os.Handler)5 IBinder (android.os.IBinder)5 RemoteCallbackList (android.os.RemoteCallbackList)5 StorageManager (android.os.storage.StorageManager)5 IndentingPrintWriter (com.android.internal.util.IndentingPrintWriter)5 FileNotFoundException (java.io.FileNotFoundException)5 ArrayList (java.util.ArrayList)5 LinkedList (java.util.LinkedList)5 List (java.util.List)5 Entry (java.util.Map.Entry)5