• RK:主屏幕


    Platform: RK3288
    OS: Android 7.1
    Kernel: 4.4.143

    Android7.0 DirectBoot阻塞开机分析 宇落无痕 https://blog.csdn.net/fu_kevin0606/article/details/65437594

    一.需求: 仿Android5.1 Settings.apk 上的 设置 主屏幕
    问题点:a.动态显示 一级设置列表 主屏幕
               b.二级设置列表 home 属性的list

    二.Android 7.1 Setttings home识别个数异常
    2.1.home属性的apk 有两个 Settings.apk Launcher.apk

        private int getHomeActivitiesCount() {
            final ArrayList<ResolveInfo> homeApps = new ArrayList<ResolveInfo>();
            getPackageManager().getHomeActivities(homeApps);
            return homeApps.size();
        }	
    

    2.2.launcher启动流程增加了settings--->FallbackHome--->launcher

    在启动Launcher之前会先启动一个FallbackHome,之后才会启动Launcher,而FallbackHome属于Settings中的一个透明的activity,
    Settings的android:directBootAware=true,并且FallbackHome在category中配置了Home属性,而Launcher的
    android:directBootAware=false,所以只有FallbackHome可以在direct boot模式下启动

    补:Direct Boot模式下app是无法运行的要运行的话需要在AndroidManinfest.xml中设置 android:directBootAware="true"

            <!-- Triggered when user-selected home app isn't encryption aware -->
            <activity android:name=".system.FallbackHome"
                      android:excludeFromRecents="true"
                      android:theme="@style/FallbackHome">
                <intent-filter android:priority="-1000">
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.HOME" />
                    <category android:name="android.intent.category.DEFAULT" />
                </intent-filter>
            </activity>

    其中包括home属性,这样影响后续识别home属性的应用,这里介绍一个过滤的办法:

     https://www.cnblogs.com/crushgirl/p/13437967.html

    android:excludeFromRecents="true"	

    在 Android 系统中,如果我们不想某个 Activity 出现在 “Recent screens” 中,可以设置这条属性:

    2.3.packagesappsSettingssrccomandroidsettingsHomeSettings.java

        private void buildHomeActivitiesList() {
            ArrayList<ResolveInfo> homeActivities = new ArrayList<ResolveInfo>();
            ComponentName currentDefaultHome  = mPm.getHomeActivities(homeActivities);
    
            Context context = getPrefContext();
            mCurrentHome = null;
            mPrefGroup.removeAll();
            mPrefs = new ArrayList<HomeAppPreference>();
            mHomeComponentSet = new ComponentName[homeActivities.size()];
            int prefIndex = 0;
            boolean supportManagedProfilesExtra =
                    getActivity().getIntent().getBooleanExtra(EXTRA_SUPPORT_MANAGED_PROFILES, false);
            boolean mustSupportManagedProfile = hasManagedProfile()
                    || supportManagedProfilesExtra;
            for (int i = 0; i < homeActivities.size(); i++) {
                final ResolveInfo candidate = homeActivities.get(i);
                final ActivityInfo info = candidate.activityInfo;
                ComponentName activityName = new ComponentName(info.packageName, info.name);
                mHomeComponentSet[i] = activityName;
                try {
                    Drawable icon = info.loadIcon(mPm);
                    CharSequence name = info.loadLabel(mPm);
                    HomeAppPreference pref;
    
                    if (mustSupportManagedProfile && !launcherHasManagedProfilesFeature(candidate)) {
                        pref = new HomeAppPreference(context, activityName, prefIndex,
                                icon, name, this, info, false /* not enabled */,
                                getResources().getString(R.string.home_work_profile_not_supported));
                    } else  {
                        pref = new HomeAppPreference(context, activityName, prefIndex,
                                icon, name, this, info, true /* enabled */, null);
                    }
    				 //FLAG_EXCLUDE_FROM_RECENTS这里对应上述的属性 android:excludeFromRecents
    				if ((info.flags & ActivityInfo.FLAG_EXCLUDE_FROM_RECENTS) == 0){
                    mPrefs.add(pref);
                    mPrefGroup.addPreference(pref);
    				}
                    if (activityName.equals(currentDefaultHome)) {
                        mCurrentHome = pref;
                    }
                    prefIndex++;
                } catch (Exception e) {
                    Log.v(TAG, "Problem dealing with activity " + activityName, e);
                }
            }
    
            if (mCurrentHome != null) {
                if (mCurrentHome.isEnabled()) {
                    getActivity().setResult(Activity.RESULT_OK);
                }
    
                new Handler().post(new Runnable() {
                   public void run() {
                       mCurrentHome.setChecked(true);
                   }
                });
            }
        }
    

      

      

      

  • 相关阅读:
    Prometheus 基于文件的服务发现
    Prometheus 标签使用示例整合
    Prometheus 重新标签
    Prometheus 配置采集目标
    Prometheus 配置文件详解
    Prometheus 安装部署
    Prometheus 介绍详解
    Python urlib 模块
    ArcGIS Python编程案例-电子资料链接
    如何查看Python对象的属性
  • 原文地址:https://www.cnblogs.com/crushgirl/p/13436696.html
Copyright © 2020-2023  润新知