项目作者: ywbpmf

项目描述 :
Android 8.0 Launcher3 的源代码
高级语言: Java
项目地址: git://github.com/ywbpmf/Launcher3.git
创建时间: 2018-01-02T07:28:50Z
项目社区:https://github.com/ywbpmf/Launcher3

开源协议:Other

下载


Launcher3

Android 8.0 Launcher3 的源代码

修改记录


  • gradle 和 protobuf 插件升级
    1. classpath 'com.android.tools.build:gradle:3.0.0'
    2. classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.2'
  • 修改gradle文件中的 applicationId
    1. applicationId 'com.my.launcher3'
    2. testApplicationId 'com.my.launcher3.tests'
  • 和系统原有的Launcher3的自定b义权限冲突,检测 AndroidManifest.xml 文件把 permission 节点中含有 com.android.launcher3 字符串的修改为 com.my.launcher3

  • 修改LauncherProvider的authorities 为:

    1. android:authorities="com.my.launcher3.settings"
    2. android:writePermission="com.my.launcher3.permission.WRITE_SETTINGS"
    3. android:readPermission="com.my.launcher3.permission.READ_SETTINGS"

     并修改com.android.launcher3.config.ProviderConfig类中的

    1. public static final String AUTHORITY = "com.my.launcher3.settings".intern();
  • 异常Error:Error: Expected resource of type animator [ResourceType]
    res\anim\discovery_bounce.xml移动res\animator\中去 并修改R.animR.animator

  • 异常

    1. java.lang.IllegalArgumentException: width and height must be > 0:
    2. at com.android.launcher3.badge.BadgeRenderer$IconDrawer.<init>(BadgeRenderer.java:167)
    3. at com.android.launcher3.badge.BadgeRenderer.<init>(BadgeRenderer.java:77)
    4. at com.android.launcher3.DeviceProfile.<init>(DeviceProfile.java:216)
    5. at com.android.launcher3.InvariantDeviceProfile.<init>(InvariantDeviceProfile.java:174)
    6. at com.android.launcher3.LauncherAppState.<init>(LauncherAppState.java:93)
    7. at com.android.launcher3.LauncherAppState.getInstance(LauncherAppState.java:55)
    8. at com.android.launcher3.Launcher.onCreate(Launcher.java:364)

    这个问题是命名空间 xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3" 导致读取device_profiles.xml资源失败, 把命名空间里的url换成http://schemas.android.com/apk/res-auto即可。相应其它使用xmlns的地方可能也存在这个问题

  • 异常 “查询快捷方式失败”

    1. Failed to query for shortcuts
    2. java.lang.SecurityException: Caller can't access shortcut information
    3. at com.android.launcher3.shortcuts.DeepShortcutManager.query(DeepShortcutManager.java:216)
    4. at com.android.launcher3.shortcuts.DeepShortcutManager.queryForPinnedShortcuts(DeepShortcutManager.java:182)
    5. at com.android.launcher3.LauncherModel$LoaderTask.loadWorkspace(LauncherModel.java:883)
    6. at com.android.launcher3.LauncherModel$LoaderTask.run(LauncherModel.java:704)

    这是Android定义了必须是默认桌面才有权限获取所有应用的Shortcuts信息。解决方法是在桌面按Home键,然后选择我们自己的Luancher3作为默认桌面(点击“始终”按钮)。接下来你看到的就是自己的Luancher3了,以为我是用虚拟机运行的,所以看到的桌面和原来的没有区别。这时我们临时修改SearchBar上面的文字(“搜索”变为“Google搜索”即可. strings.xml 的abandoned_search


定制修改


  • 配置桌面搜索框(QSB)
    ```
    FeatureFlags.java

    QSB_ON_FIRST_SCREEN = false // 搜索框开启按钮
    PULLDOWN_SEARCH = false // 第一屏是否支持下拉进入搜索动作

```