Search in sources :

Example 1 with UserManagerService

use of com.android.server.pm.UserManagerService in project platform_frameworks_base by android.

the class UserController method getUserManager.

private UserManagerService getUserManager() {
    UserManagerService userManager = mUserManager;
    if (userManager == null) {
        IBinder b = ServiceManager.getService(Context.USER_SERVICE);
        userManager = mUserManager = (UserManagerService) IUserManager.Stub.asInterface(b);
    }
    return userManager;
}
Also used : IBinder(android.os.IBinder) UserManagerService(com.android.server.pm.UserManagerService)

Example 2 with UserManagerService

use of com.android.server.pm.UserManagerService in project android_frameworks_base by ParanoidAndroid.

the class MountService method readStorageListLocked.

private void readStorageListLocked() {
    mVolumes.clear();
    mVolumeStates.clear();
    Resources resources = mContext.getResources();
    int id = com.android.internal.R.xml.storage_list;
    XmlResourceParser parser = resources.getXml(id);
    AttributeSet attrs = Xml.asAttributeSet(parser);
    try {
        XmlUtils.beginDocument(parser, TAG_STORAGE_LIST);
        while (true) {
            XmlUtils.nextElement(parser);
            String element = parser.getName();
            if (element == null)
                break;
            if (TAG_STORAGE.equals(element)) {
                TypedArray a = resources.obtainAttributes(attrs, com.android.internal.R.styleable.Storage);
                String path = a.getString(com.android.internal.R.styleable.Storage_mountPoint);
                int descriptionId = a.getResourceId(com.android.internal.R.styleable.Storage_storageDescription, -1);
                CharSequence description = a.getText(com.android.internal.R.styleable.Storage_storageDescription);
                boolean primary = a.getBoolean(com.android.internal.R.styleable.Storage_primary, false);
                boolean removable = a.getBoolean(com.android.internal.R.styleable.Storage_removable, false);
                boolean emulated = a.getBoolean(com.android.internal.R.styleable.Storage_emulated, false);
                int mtpReserve = a.getInt(com.android.internal.R.styleable.Storage_mtpReserve, 0);
                boolean allowMassStorage = a.getBoolean(com.android.internal.R.styleable.Storage_allowMassStorage, false);
                // resource parser does not support longs, so XML value is in megabytes
                long maxFileSize = a.getInt(com.android.internal.R.styleable.Storage_maxFileSize, 0) * 1024L * 1024L;
                Slog.d(TAG, "got storage path: " + path + " description: " + description + " primary: " + primary + " removable: " + removable + " emulated: " + emulated + " mtpReserve: " + mtpReserve + " allowMassStorage: " + allowMassStorage + " maxFileSize: " + maxFileSize);
                if (emulated) {
                    // For devices with emulated storage, we create separate
                    // volumes for each known user.
                    mEmulatedTemplate = new StorageVolume(null, descriptionId, true, false, true, mtpReserve, false, maxFileSize, null);
                    final UserManagerService userManager = UserManagerService.getInstance();
                    for (UserInfo user : userManager.getUsers(false)) {
                        createEmulatedVolumeForUserLocked(user.getUserHandle());
                    }
                } else {
                    if (path == null || description == null) {
                        Slog.e(TAG, "Missing storage path or description in readStorageList");
                    } else {
                        final StorageVolume volume = new StorageVolume(new File(path), descriptionId, primary, removable, emulated, mtpReserve, allowMassStorage, maxFileSize, null);
                        addVolumeLocked(volume);
                    }
                }
                a.recycle();
            }
        }
    } catch (XmlPullParserException e) {
        throw new RuntimeException(e);
    } catch (IOException e) {
        throw new RuntimeException(e);
    } finally {
        // Compute storage ID for each physical volume; emulated storage is
        // always 0 when defined.
        int index = isExternalStorageEmulated() ? 1 : 0;
        for (StorageVolume volume : mVolumes) {
            if (!volume.isEmulated()) {
                volume.setStorageId(index++);
            }
        }
        parser.close();
    }
}
Also used : XmlResourceParser(android.content.res.XmlResourceParser) UserInfo(android.content.pm.UserInfo) IOException(java.io.IOException) StorageVolume(android.os.storage.StorageVolume) UserManagerService(com.android.server.pm.UserManagerService) AttributeSet(android.util.AttributeSet) TypedArray(android.content.res.TypedArray) XmlPullParserException(org.xmlpull.v1.XmlPullParserException) Resources(android.content.res.Resources) File(java.io.File)

Example 3 with UserManagerService

use of com.android.server.pm.UserManagerService in project android_frameworks_base by AOSPA.

the class UserController method getUserManager.

private UserManagerService getUserManager() {
    UserManagerService userManager = mUserManager;
    if (userManager == null) {
        IBinder b = ServiceManager.getService(Context.USER_SERVICE);
        userManager = mUserManager = (UserManagerService) IUserManager.Stub.asInterface(b);
    }
    return userManager;
}
Also used : IBinder(android.os.IBinder) UserManagerService(com.android.server.pm.UserManagerService)

Example 4 with UserManagerService

use of com.android.server.pm.UserManagerService in project android_frameworks_base by DirtyUnicorns.

the class UserController method getUserManager.

private UserManagerService getUserManager() {
    UserManagerService userManager = mUserManager;
    if (userManager == null) {
        IBinder b = ServiceManager.getService(Context.USER_SERVICE);
        userManager = mUserManager = (UserManagerService) IUserManager.Stub.asInterface(b);
    }
    return userManager;
}
Also used : IBinder(android.os.IBinder) UserManagerService(com.android.server.pm.UserManagerService)

Example 5 with UserManagerService

use of com.android.server.pm.UserManagerService in project android_frameworks_base by ResurrectionRemix.

the class UserController method getUserManager.

private UserManagerService getUserManager() {
    UserManagerService userManager = mUserManager;
    if (userManager == null) {
        IBinder b = ServiceManager.getService(Context.USER_SERVICE);
        userManager = mUserManager = (UserManagerService) IUserManager.Stub.asInterface(b);
    }
    return userManager;
}
Also used : IBinder(android.os.IBinder) UserManagerService(com.android.server.pm.UserManagerService)

Aggregations

UserManagerService (com.android.server.pm.UserManagerService)6 IBinder (android.os.IBinder)5 UserInfo (android.content.pm.UserInfo)1 Resources (android.content.res.Resources)1 TypedArray (android.content.res.TypedArray)1 XmlResourceParser (android.content.res.XmlResourceParser)1 StorageVolume (android.os.storage.StorageVolume)1 AttributeSet (android.util.AttributeSet)1 File (java.io.File)1 IOException (java.io.IOException)1 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)1