Loading AndroidManifest.xml +2 −0 Original line number Diff line number Diff line Loading @@ -1135,6 +1135,7 @@ android:targetActivity=".applications.InstalledAppDetailsTop"> <intent-filter android:priority="1"> <action android:name="android.settings.APPLICATION_DETAILS_SETTINGS" /> <action android:name="android.intent.action.AUTO_REVOKE_PERMISSIONS" /> <category android:name="android.intent.category.DEFAULT" /> <data android:scheme="package" /> </intent-filter> Loading Loading @@ -3180,6 +3181,7 @@ android:theme="@style/Theme.Panel" android:launchMode="singleInstance" android:excludeFromRecents="true" android:configChanges="orientation|keyboardHidden|screenSize" android:exported="true"> <intent-filter> <action android:name="android.settings.panel.action.INTERNET_CONNECTIVITY" /> Loading res/drawable/accessibility_captions.png −1.42 KiB (1.39 KiB) Loading image diff... res/layout/accessibility_captions_preview.xml +14 −14 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2020 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. Copyright (C) 2020 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <FrameLayout Loading res/values/config.xml +11 −0 Original line number Diff line number Diff line Loading @@ -220,10 +220,21 @@ <!-- Settings intelligence interaction log intent action --> <string name="config_settingsintelligence_log_action" translatable="false"></string> <!-- AOSP Emergency app package name --> <string name="config_aosp_emergency_package_name" translatable="false"> com.android.emergency </string> <!-- AOSP Emergency app intent action --> <string name="config_aosp_emergency_intent_action" translatable="false"> android.settings.EDIT_EMERGENCY_INFO </string> <!-- Emergency app package name --> <string name="config_emergency_package_name" translatable="false"> com.android.emergency </string> <!-- Emergency app intent action --> <string name="config_emergency_intent_action" translatable="false"> android.settings.EDIT_EMERGENCY_INFO Loading src/com/android/settings/accounts/EmergencyInfoPreferenceController.java +36 −14 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.os.UserHandle; import android.os.UserManager; import android.text.TextUtils; import androidx.annotation.VisibleForTesting; import androidx.preference.Preference; import com.android.settings.R; Loading @@ -34,9 +35,8 @@ import java.util.List; public class EmergencyInfoPreferenceController extends BasePreferenceController { public static String getIntentAction(Context context) { return context.getResources().getString(R.string.config_emergency_intent_action); } @VisibleForTesting Intent mIntent; public EmergencyInfoPreferenceController(Context context, String preferenceKey) { super(context, preferenceKey); Loading @@ -62,10 +62,9 @@ public class EmergencyInfoPreferenceController extends BasePreferenceController @Override public boolean handlePreferenceTreeClick(Preference preference) { if (TextUtils.equals(getPreferenceKey(), preference.getKey())) { Intent intent = new Intent(getIntentAction(mContext)); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); mContext.startActivity(intent); if (TextUtils.equals(getPreferenceKey(), preference.getKey()) && mIntent != null) { mIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); mContext.startActivity(mIntent); return true; } return false; Loading @@ -76,15 +75,38 @@ public class EmergencyInfoPreferenceController extends BasePreferenceController if (!mContext.getResources().getBoolean(R.bool.config_show_emergency_info_in_device_info)) { return UNSUPPORTED_ON_DEVICE; } final Intent intent = new Intent(getIntentAction(mContext)).setPackage( getPackageName(mContext)); final List<ResolveInfo> infos = mContext.getPackageManager().queryIntentActivities(intent, // If the variant of emergency info can not work, we should fallback to AOSP version. if (isEmergencyInfoSupported()) { return AVAILABLE; } else if (isAOSPVersionSupported()) { return AVAILABLE; } return UNSUPPORTED_ON_DEVICE; } private boolean isEmergencyInfoSupported() { final String packageName = mContext.getResources().getString( R.string.config_emergency_package_name); final String intentName = mContext.getResources().getString( R.string.config_emergency_intent_action); mIntent = new Intent(intentName).setPackage(packageName); final List<ResolveInfo> infos = mContext.getPackageManager().queryIntentActivities(mIntent, 0); return infos != null && !infos.isEmpty() ? AVAILABLE : UNSUPPORTED_ON_DEVICE; return infos != null && !infos.isEmpty(); } private static String getPackageName(Context context) { return context.getResources().getString(R.string.config_emergency_package_name); private boolean isAOSPVersionSupported() { final String aospPackageName = mContext.getResources().getString( R.string.config_aosp_emergency_package_name); final String aospIntentName = mContext.getResources().getString( R.string.config_aosp_emergency_intent_action); mIntent = new Intent(aospIntentName).setPackage(aospPackageName); final List<ResolveInfo> infos = mContext.getPackageManager().queryIntentActivities(mIntent, 0); return infos != null && !infos.isEmpty(); } } Loading
AndroidManifest.xml +2 −0 Original line number Diff line number Diff line Loading @@ -1135,6 +1135,7 @@ android:targetActivity=".applications.InstalledAppDetailsTop"> <intent-filter android:priority="1"> <action android:name="android.settings.APPLICATION_DETAILS_SETTINGS" /> <action android:name="android.intent.action.AUTO_REVOKE_PERMISSIONS" /> <category android:name="android.intent.category.DEFAULT" /> <data android:scheme="package" /> </intent-filter> Loading Loading @@ -3180,6 +3181,7 @@ android:theme="@style/Theme.Panel" android:launchMode="singleInstance" android:excludeFromRecents="true" android:configChanges="orientation|keyboardHidden|screenSize" android:exported="true"> <intent-filter> <action android:name="android.settings.panel.action.INTERNET_CONNECTIVITY" /> Loading
res/layout/accessibility_captions_preview.xml +14 −14 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2020 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. Copyright (C) 2020 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <FrameLayout Loading
res/values/config.xml +11 −0 Original line number Diff line number Diff line Loading @@ -220,10 +220,21 @@ <!-- Settings intelligence interaction log intent action --> <string name="config_settingsintelligence_log_action" translatable="false"></string> <!-- AOSP Emergency app package name --> <string name="config_aosp_emergency_package_name" translatable="false"> com.android.emergency </string> <!-- AOSP Emergency app intent action --> <string name="config_aosp_emergency_intent_action" translatable="false"> android.settings.EDIT_EMERGENCY_INFO </string> <!-- Emergency app package name --> <string name="config_emergency_package_name" translatable="false"> com.android.emergency </string> <!-- Emergency app intent action --> <string name="config_emergency_intent_action" translatable="false"> android.settings.EDIT_EMERGENCY_INFO Loading
src/com/android/settings/accounts/EmergencyInfoPreferenceController.java +36 −14 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.os.UserHandle; import android.os.UserManager; import android.text.TextUtils; import androidx.annotation.VisibleForTesting; import androidx.preference.Preference; import com.android.settings.R; Loading @@ -34,9 +35,8 @@ import java.util.List; public class EmergencyInfoPreferenceController extends BasePreferenceController { public static String getIntentAction(Context context) { return context.getResources().getString(R.string.config_emergency_intent_action); } @VisibleForTesting Intent mIntent; public EmergencyInfoPreferenceController(Context context, String preferenceKey) { super(context, preferenceKey); Loading @@ -62,10 +62,9 @@ public class EmergencyInfoPreferenceController extends BasePreferenceController @Override public boolean handlePreferenceTreeClick(Preference preference) { if (TextUtils.equals(getPreferenceKey(), preference.getKey())) { Intent intent = new Intent(getIntentAction(mContext)); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); mContext.startActivity(intent); if (TextUtils.equals(getPreferenceKey(), preference.getKey()) && mIntent != null) { mIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); mContext.startActivity(mIntent); return true; } return false; Loading @@ -76,15 +75,38 @@ public class EmergencyInfoPreferenceController extends BasePreferenceController if (!mContext.getResources().getBoolean(R.bool.config_show_emergency_info_in_device_info)) { return UNSUPPORTED_ON_DEVICE; } final Intent intent = new Intent(getIntentAction(mContext)).setPackage( getPackageName(mContext)); final List<ResolveInfo> infos = mContext.getPackageManager().queryIntentActivities(intent, // If the variant of emergency info can not work, we should fallback to AOSP version. if (isEmergencyInfoSupported()) { return AVAILABLE; } else if (isAOSPVersionSupported()) { return AVAILABLE; } return UNSUPPORTED_ON_DEVICE; } private boolean isEmergencyInfoSupported() { final String packageName = mContext.getResources().getString( R.string.config_emergency_package_name); final String intentName = mContext.getResources().getString( R.string.config_emergency_intent_action); mIntent = new Intent(intentName).setPackage(packageName); final List<ResolveInfo> infos = mContext.getPackageManager().queryIntentActivities(mIntent, 0); return infos != null && !infos.isEmpty() ? AVAILABLE : UNSUPPORTED_ON_DEVICE; return infos != null && !infos.isEmpty(); } private static String getPackageName(Context context) { return context.getResources().getString(R.string.config_emergency_package_name); private boolean isAOSPVersionSupported() { final String aospPackageName = mContext.getResources().getString( R.string.config_aosp_emergency_package_name); final String aospIntentName = mContext.getResources().getString( R.string.config_aosp_emergency_intent_action); mIntent = new Intent(aospIntentName).setPackage(aospPackageName); final List<ResolveInfo> infos = mContext.getPackageManager().queryIntentActivities(mIntent, 0); return infos != null && !infos.isEmpty(); } }