隐藏帐户

    xiaoxiao2021-03-25  49

    操作步骤】: 1、打开设置-帐户 2、添加帐户 【测试结果】:添加帐户有sim卡和电话项

    【预期结果】:无sim卡相关项

    res/values/arrays.xml    <!-- Defined the hide accounts' type -->     <string-array name="hide_account_list">         <item>com.android.localphone</item>         <item>com.android.sim</item>     </string-array>

    src/com/android/settings/Utils.java

    /**         * Returns if need show the account with the given account type.         */     public static boolean showAccount(Context context, String accountType) {           String[] hideAccounts = context.getResources().getStringArray(R.array.hide_account_list);           if (hideAccounts == null || hideAccounts.length == 0) return true;         for (String account : hideAccounts) {             if (account.equals(accountType)) return false;         }         return true;     }   src/com/android/settings/accounts/ChooseAccountActivity.java     private void onAuthDescriptionsUpdated() {            // Create list of providers to show on preference screen

           // Create list of providers to show on preference screen            for (int i = 0; i < mAuthDescs.length; i++) {        

    for (int i = 0; i < mAuthDescs.length; i++) {                 String accountType = mAuthDescs[i].type;            

    String accountType = mAuthDescs[i].type;               if (!Utils.showAccount(this, accountType)) {                   // If needn't to show the account, skip this account.                   continue;              }

    转载请注明原文地址: https://ju.6miu.com/read-150326.html

    最新回复(0)