private StorageVolumePreferenceCategory(Context context, StorageVolume volume) {
    super(context);

    mVolume = volume;
    mMeasure = StorageMeasurement.getInstance(context, volume);

    mResources = context.getResources();
    mStorageManager = StorageManager.from(context);
    mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);

    setTitle(
        volume != null
            ? volume.getDescription(context)
            : context.getText(R.string.internal_storage));
  }
コード例 #2
0
  public void systemReady() {
    if (DEBUG) Slog.d(TAG, "systemReady");

    mNotificationManager =
        (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);

    // We do not show the USB notification if the primary volume supports mass storage.
    // The legacy mass storage UI will be used instead.
    boolean massStorageSupported = false;
    final StorageManager storageManager = StorageManager.from(mContext);
    final StorageVolume primary = storageManager.getPrimaryVolume();
    massStorageSupported = primary != null && primary.allowMassStorage();
    mUseUsbNotification = !massStorageSupported;

    // make sure the ADB_ENABLED setting value matches the current state
    Settings.Global.putInt(mContentResolver, Settings.Global.ADB_ENABLED, mAdbEnabled ? 1 : 0);

    mHandler.sendEmptyMessage(MSG_SYSTEM_READY);
  }