Android – preferred application for similar applications at initial device setup / startup in custom ROM

We are building our own AOSP / custom ROM with the latest version of lollipop

What we are trying to build is to pre install two home screens on the device to build a custom Rom. one will be the standard andoid "launcher3", and the other will be our own home screen application "foobarhome". So far, it's good: -)

Our current initial device startup phase is roughly as follows: – device startup animation – GMS setupwizard (Wi Fi, language, Google account settings, etc.) * * * the device reaches the setting completion state * * * * – resolveactivity starts to display the choice between our own home application "foobarhome" and launcher3 (> > bad guy < <) – we must select "foobarhome" to run "Always" – our home screen application is up and running

Problem: Unfortunately, we will get resolveractivity immediately after the GMS setupwizard is completed. Resolveractivity lets us choose between launcher3 and our home screen application. We must manually select our home application (always running). Goal: start our home application directly without resolveractivity

Oil slick on the water: when building the custom ROM and executing all our Android make files, we copy the so-called preferred-activities-home.xml to system / etc / preferred apps /

In our whatever.mk, we have the following lines of code: preferred application settings:

PRODUCT_COPY_FILES += \
    myLocalPath/preferred_activities/preferred-activities-home.xml:system/etc/preferred-apps/preferred-activities-home.xml

The contents of these preferred-activities-home.xml are as follows:

<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
<preferred-activities>
    <item name="com.example.foobarhome/.MainActivity" match="100000" set="2">
        <set name="com.android.launcher3/com.android.launcher3.Launcher" />
        <set name="com.example.foobarhome/.MainActivity" />
        <filter>
            <action name="android.intent.action.MAIN" />
            <cat name="android.intent.category.HOME" />
            <cat name="android.intent.category.DEFAULT" />
        </filter>
    </item>
</preferred-activities>

You may know that the frameworks / base / services / core / Java / COM / Android / server / PM / packagemanagerservice.java and. / settings.java classes are handling such configurations

Invalid Sign

<preferred-activities> ... </preferred-activities>

Our output is:

<item name="com.example.foobarhome/.MainActivity" match="100000" always="true" set="4">
    <set name="com.android.settings/.CryptKeeper" />
    <set name="com.google.android.setupwizard/.SetupWizardActivity" />
    <set name="com.example.foobarhome/.MainActivity" />
    <set name="com.android.launcher3/com.android.launcher3.Launcher" />
    <filter>
        <action name="android.intent.action.MAIN" />
        <cat name="android.intent.category.HOME" />
        <cat name="android.intent.category.DEFAULT" />
    </filter>
</item>

Invalid Sign

  Use foobarhome as HOME
  buttons "always" and "just once"
  --------------------------------
  Use a different app
  Launcher3

Invalid Sign

<item name="com.example.foobarhome/.MainActivity" match="100000" always="false" set="0">
    <filter>
        <action name="android.intent.action.MAIN" />
        <cat name="android.intent.category.HOME" />
        <cat name="android.intent.category.DEFAULT" />
    </filter>
</item>

Why is launcher3 lost?

3) After selecting our foobarhome application to always run, we check package-restrictions.xml again and see - we expect to see it after the GMS setupwizard is completed. The output is:

<item name="com.example.foobarhome/.MainActivity" match="100000" always="true" set="2">
    <set name="com.example.foobarhome/.MainActivity" />
    <set name="com.android.launcher3/com.android.launcher3.Launcher" />
    <filter>
        <action name="android.intent.action.MAIN" />
        <cat name="android.intent.category.HOME" />
        <cat name="android.intent.category.DEFAULT" />
    </filter>
</item>

Usually, these preferred-activities.xml methods work, but somehow they don't work during initial device startup / setup. We want to know why we released the second home application (launcher3) in package-restrictions.xml on our way to resolveractivity

Question: Q1: is there any way to pre select a home screen application in settings.apk (packages / apps / settings), possibly through AOSP_ Root / frameworks / base / core / Java / Android / content / RES / configuration.java. May this solve this problem?

Invalid Sign

Main problem: how can we solve this problem if we don't get resolver Activiy during initial device startup / setup?

resolvent:

For Q1: I think you can do it like chooseactivity. The key is to find the appropriate execution time before the launcher. I know that provision is the best place. You can call addpreferredactivity() carried by packagemanager before the supply is disabled

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>