Fixes instant apps on the Opening links screen
Updates strings to the correct values. Adds the Instant apps account preference, which launches the instant apps accounts chooser. Test: manual test of the settings screen. Bug: 36514506 Change-Id: I876d0d242bf40a379a3737bc6422e2835fc17839
This commit is contained in:
@@ -8413,14 +8413,16 @@
|
|||||||
<string name="automatic_storage_manager_freed_bytes"><xliff:g id="size" example="3.25MB">%1$s</xliff:g> total made available\n\nLast ran on <xliff:g id="date" example="Jan 12">%2$s</xliff:g></string>
|
<string name="automatic_storage_manager_freed_bytes"><xliff:g id="size" example="3.25MB">%1$s</xliff:g> total made available\n\nLast ran on <xliff:g id="date" example="Jan 12">%2$s</xliff:g></string>
|
||||||
|
|
||||||
<!-- Title text for enabling web actions. [CHAR_LIMIT=60] -->
|
<!-- Title text for enabling web actions. [CHAR_LIMIT=60] -->
|
||||||
<string name="web_action_enable_title">Open links in apps</string>
|
<string name="web_action_enable_title">Instant apps</string>
|
||||||
|
|
||||||
<!-- Summary text for enabling web actions. [CHAR_LIMIT=250] -->
|
<!-- Summary text for enabling web actions. [CHAR_LIMIT=250] -->
|
||||||
<string name="web_action_enable_summary">Open links in supported apps, even if the
|
<string name="web_action_enable_summary">Open links in apps, even if they’re not installed</string>
|
||||||
apps aren’t installed on your device</string>
|
|
||||||
|
|
||||||
<!-- Section title for the Web Action preference [CHAR LIMIT=60] -->
|
<!-- Section title for the Web Action preference [CHAR LIMIT=60] -->
|
||||||
<string name="web_action_section_title">Apps not installed</string>
|
<string name="web_action_section_title">Instant apps</string>
|
||||||
|
|
||||||
|
<!-- Preference label for an tappable preference that will open the account chooser for instant apps. [CHAR LIMIT=60] -->
|
||||||
|
<string name="instant_apps_account">Instant apps account</string>
|
||||||
|
|
||||||
<!-- Section title for the Domain URL app preference list [CHAR LIMIT=60]-->
|
<!-- Section title for the Domain URL app preference list [CHAR LIMIT=60]-->
|
||||||
<string name="domain_url_section_title">Installed apps</string>
|
<string name="domain_url_section_title">Installed apps</string>
|
||||||
|
@@ -15,7 +15,9 @@
|
|||||||
package com.android.settings.applications;
|
package com.android.settings.applications;
|
||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
@@ -55,6 +57,7 @@ public class ManageDomainUrls extends SettingsPreferenceFragment
|
|||||||
private ApplicationsState.Session mSession;
|
private ApplicationsState.Session mSession;
|
||||||
private PreferenceGroup mDomainAppList;
|
private PreferenceGroup mDomainAppList;
|
||||||
private SwitchPreference mWebAction;
|
private SwitchPreference mWebAction;
|
||||||
|
private Preference mInstantAppAccountPreference;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle icicle) {
|
public void onCreate(Bundle icicle) {
|
||||||
@@ -126,6 +129,26 @@ public class ManageDomainUrls extends SettingsPreferenceFragment
|
|||||||
mWebAction.setOnPreferenceChangeListener(this);
|
mWebAction.setOnPreferenceChangeListener(this);
|
||||||
webActionCategory.addPreference(mWebAction);
|
webActionCategory.addPreference(mWebAction);
|
||||||
|
|
||||||
|
// Determine whether we should show the instant apps account chooser setting
|
||||||
|
ComponentName instantAppSettingsComponent = getActivity().getPackageManager()
|
||||||
|
.getInstantAppResolverSettingsComponent();
|
||||||
|
Intent instantAppSettingsIntent = null;
|
||||||
|
if (instantAppSettingsComponent != null) {
|
||||||
|
instantAppSettingsIntent =
|
||||||
|
new Intent().setComponent(instantAppSettingsComponent);
|
||||||
|
}
|
||||||
|
if (instantAppSettingsIntent != null) {
|
||||||
|
final Intent launchIntent = instantAppSettingsIntent;
|
||||||
|
// TODO: Make this button actually launch the account chooser.
|
||||||
|
mInstantAppAccountPreference = new Preference(getPrefContext());
|
||||||
|
mInstantAppAccountPreference.setTitle(R.string.instant_apps_account);
|
||||||
|
mInstantAppAccountPreference.setOnPreferenceClickListener(pref -> {
|
||||||
|
startActivity(launchIntent);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
webActionCategory.addPreference(mInstantAppAccountPreference);
|
||||||
|
}
|
||||||
|
|
||||||
// list to manage link handling per app
|
// list to manage link handling per app
|
||||||
mDomainAppList = new PreferenceCategory(getPrefContext());
|
mDomainAppList = new PreferenceCategory(getPrefContext());
|
||||||
mDomainAppList.setTitle(R.string.domain_url_section_title);
|
mDomainAppList.setTitle(R.string.domain_url_section_title);
|
||||||
@@ -138,9 +161,11 @@ public class ManageDomainUrls extends SettingsPreferenceFragment
|
|||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
if (preference == mWebAction) {
|
if (preference == mWebAction) {
|
||||||
final int enabled = (boolean) newValue ? 1 : 0;
|
boolean checked = (boolean) newValue;
|
||||||
Settings.Secure.putInt(
|
Settings.Secure.putInt(
|
||||||
getContentResolver(), Settings.Secure.WEB_ACTION_ENABLED, enabled);
|
getContentResolver(),
|
||||||
|
Settings.Secure.WEB_ACTION_ENABLED, checked ? 1 : 0);
|
||||||
|
mWebAction.setChecked(checked);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
Reference in New Issue
Block a user