AAOS Car UI Library

Car UI Library

Summary

  • What can customization
    • Components --> Java classes that implement a specific behavior. For example, CarUiRecyclerView and Toolbar
    • Resources --> Individual Android resources that represent the knobs available for OEMs to achieve consistency with their own design. The components above use these resources to become customizable
  • How to customization
    • TargetApp to integrate the Car UI Library
    • Build-time overlays for build AAOS
    • OverlayApp use dynamic runtime overlays (dynamic RRO)
    • OverlayApp use static runtime overlays (static RRO)

Comprehensive structure

car_ui_library_where.png

What can we do for different role

flow.png

Car UI Library

CULibrary.png

Run time resource overlays

RROs.png

What can customization in Car-UI-Library

  • preference

    ID|
    --|--:
    CarUiDropDownPreference|
    CarUiEditTextPreference|
    CarUiListPreference|
    CarUiMultiSelectListPreference|
    CarUiTwoActionPreference|
    CarUiRadioButtonPreference|
    CarUiSeekBarDialogPreference|
    CarUiSwitchPreference|
    CarUiTwoActionPreference|

  • recyclerView

    ID|
    --|--:
    GridDividerItemDecoration|
    GridOffsetItemDecoration|
    LinearDividerItemDecoration|
    LinearOffsetItemDecoration|
    CarUIListItem|
    CarUiCheckBoxListItem|
    CarUiContentListItem|
    CarUiHeaderListItem|
    CarUiRadioButtonListItem|
    CarUiSmoothScroller|
    FastScroller|

  • tool bar

    ID|
    --|--:
    MenuItem|
    ProgressBarController|
    SearchView|
    TabLayout|
    Toolbar|

  • Forcus

  • CarUxRestriction

https://cs.android.com/android/platform/superproject/+/master:packages/apps/Car/libs/car-ui-lib/car-ui-lib/src/main/res-overlayable/values/overlayable.xml

How to customization

Build-time overlays

This customization is applied at Android system image build time. During the build, all apps in the system receive resources from their res folder and from overlay folders defined in the target makefiles.

Resource Overlays (RROs)

  • OverLayApk need do

Define the overlay resource map: The following code shows an example res/xml/overlays.xml file.

<?xml version="1.0" encoding="utf-8"?>
<overlay xmlns:android="http://schemas.android.com/apk/res/android" >
    <!-- Overlays string/config1 and string/config2 with the same resource. -->
    <item target="string/config1" value="@string/overlay1" />
    <item target="string/config2" value="@string/overlay1" />

    <!-- Overlays string/config3 with the string "yes". -->
    <item target="string/config3" value="@android:string/yes" />

    <!-- Overlays string/config4 with the string "Hardcoded string". -->
    <item target="string/config4" value="Hardcoded string" />

    <!-- Overlays integer/config5 with the integer "42". -->
    <item target="integer/config5" value="42" />
</overlay>

And link the resource map:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.overlay">
    <application android:hasCode="false" />
    <overlay android:targetPackage="com.example.target"
                   android:targetName="OverlayableResources"
                   android:resourcesMap="@xml/overlays"/>
</manifest>
  • TargetApk need do

Define overlayable in the following example res/values/overlayable.xml file

<!-- The collection of resources for theming the appearance of the device -->
<overlayable name="ThemeResources">
       <policy type="public">
               <item type="string" name="foo/" />
               <item type="integer" name="bar/" />
       </policy>
       ...
</overlayable>

Use the “policy” tag to enforce restrictions on overlayable resources. The type attribute specifies which policies an overlay must fulfill to override the included resources. Supported types include the following.

  • public. Any overlay can override the resource.
  • system. Any overlay on the system partition can override the resources.
  • vendor. Any overlay on the vendor partition can override the resources.
  • product. Any overlay on the product partition can override the resources.
  • signature. Any overlay signed with the same signature as the target APK can override the resources.

If the target package doesn't have a defined overlayable, the overlay must be preinstalled on the system image or signed with the same signature as the target to overlay the target package's resources.

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。