安卓多用户管理之UserManagerService.UserData类


前言

UserManagerService.java内容繁多,对其进行逐个部分的拆解分析,本文对其内部UserData类进行基本说明和解读


UserData----用户资料

1.1 源码

    /**
     * Internal non-parcelable wrapper for UserInfo that is not exposed to other system apps.
     * 未公开给其他系统应用程序的UserInfo的内部不可分组包装。
     */
    @VisibleForTesting
    static class UserData {
   
        // Basic user information and properties    基本用户信息和属性
        UserInfo info;
        // Account name used when there is a strong association between a user and an account
        // 当用户和帐户之间存在强关联时使用的帐户名
        String account;
        // Account information for seeding into a newly created user. This could also be
        // used for login validation for an existing user, for updating their credentials.
        // In the latter case, data may not need to be persisted as it is only valid for the
        // current login session.
        /*
        用于种子设定到新创建的用户的帐户信息。这也可以用于现有用户的登录验证,用于更新他们的凭据。
        在后一种情况下,数据可能不需要持久化,因为它只对当前登录会话有效。
        */
        String seedAccountName;
        String seedAccountType;
        PersistableBundle seedAccountOptions;
        // Whether to perist the seed account information to be available after a boot
        // 是否在引导后销毁可用的种子帐户信息
        boolean persistSeedData;

        /** Elapsed realtime since boot when the user started. */ /**自用户启动后实时运行的时间*/
        long startRealtime;

        /** Elapsed realtime since boot when the user was unlocked. */ /**自用户解锁时启动以来实时运行的时间*/
        long unlockRealtime;

        private long mLastRequestQuietModeEnabledMillis;

        /**
         * {@code true} if the system should ignore errors when preparing the
         * storage directories for this user. This is {@code false} for all new
         * users; it will only be {@code true} for users that already existed
         * on-disk from an older version of Android.
         */
         /**
         /**
  		如果系统在准备此用户的存储目录时应忽略错误。这对所有新用户来说都是错误的;
		这只适用于已经存在于旧版本Android磁盘上的用户。
         */
        private boolean mIgnorePrepareStorageErrors;

        void setLastRequestQuietModeEnabledMillis(long millis) {
   
            mLastRequestQuietModeEnabledMillis = millis;
        }

        long getLastRequestQuietModeEnabledMillis() {
   
            return mLastRequestQuietModeEnabledMillis;
        }

        boolean getIgnorePrepareStorageErrors() {
   
            return mIgnorePrepareStorageErrors;
        }

        void setIgnorePrepareStorageErrors() {
   
            mIgnorePrepareStorageErrors = true;
        }

        void clearSeedAccountData() {
   
            seedAccountName = null;
            seedAccountType = null;
            seedAccountOptions = null;
            persistSeedData = false;
        }
    }

1.2 属性

属性 类型 含义
info UserInfo 基本用户信息和属性
account String 当用户和帐户之间存在强关联时使用的帐户名
seedAccountName String 种子账户名称
seedAccountType String 种子账户类型
seedAccountOptions PersistableBundle 种子账户选项
persistSeedData boolean 存留种子信息
startRealtime long 自用户启动后实时运行的时间
unlockRealtime long 自用户解锁时启动以来实时运行的时间
mLastRequestQuietModeEnabledMillis long 上次请求静态模式Enabled毫秒时间
mIgnorePrepareStorageErrors boolean 忽视准备存储错误

1.3 方法

方法 返回值 参数 含义
setLastRequestQuietModeEnabledMillis void long millis 设置上次请求静态模式Enabled毫秒时间为millis
getLastRequestQuietModeEnabledMillis long 返回上次请求静态模式Enabled毫秒时间
getIgnorePrepareStorageErrors boolean 返回mIgnorePrepareStorageErrors的值
setIgnorePrepareStorageErrors void 设置mIgnorePrepareStorageErrors的值为true
clearSeedAccountData void 清除种子账户信息,seedAccountName 、type、options为null, persistSeedData为false。

相关推荐

  1. 用户管理UserManagerService.UserData

    2024-01-09 12:36:02       44 阅读
  2. 用户管理Userinfo

    2024-01-09 12:36:02       38 阅读
  3. 用户管理IUserManager.AIDL

    2024-01-09 12:36:02       31 阅读
  4. 文件管理

    2024-01-09 12:36:02       19 阅读
  5. 用户数据安全现状以及相关技术优劣分析

    2024-01-09 12:36:02       28 阅读
  6. 作业002 - 用户登录窗口

    2024-01-09 12:36:02       35 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-01-09 12:36:02       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-01-09 12:36:02       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-01-09 12:36:02       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-01-09 12:36:02       20 阅读

热门阅读

  1. 面试 React 框架八股文十问十答第二期

    2024-01-09 12:36:02       42 阅读
  2. 用gpt写的登录页面

    2024-01-09 12:36:02       30 阅读
  3. C++ 数据结构

    2024-01-09 12:36:02       28 阅读
  4. 若依 模态框调整

    2024-01-09 12:36:02       32 阅读
  5. Python Unicode 系统

    2024-01-09 12:36:02       34 阅读
  6. 算法每日一题:回旋镖的数量 | 坐标距离 | 哈希

    2024-01-09 12:36:02       36 阅读
  7. 网络安全之文件上传

    2024-01-09 12:36:02       34 阅读
  8. 展开运算符(Spread Operator)

    2024-01-09 12:36:02       34 阅读