Move from an alert dialog to a full screen dialog for SIM app install

Bug: 70906683
Test: Local install and tests
Change-Id: Idafee66814ec3e7b8a4a1254ba5f3e55b7bf864a
This commit is contained in:
goneil
2018-01-23 17:37:26 -08:00
parent 2f5b9c9b03
commit 4291960c7d
17 changed files with 465 additions and 7 deletions

View File

@@ -4162,6 +4162,8 @@ package android.provider {
method public static void resetToDefaults(android.content.ContentResolver, java.lang.String);
field public static final java.lang.String AUTOFILL_COMPAT_ALLOWED_PACKAGES = "autofill_compat_allowed_packages";
field public static final java.lang.String DEFAULT_SM_DP_PLUS = "default_sm_dp_plus";
field public static final java.lang.String INSTALL_CARRIER_APP_NOTIFICATION_PERSISTENT = "install_carrier_app_notification_persistent";
field public static final java.lang.String INSTALL_CARRIER_APP_NOTIFICATION_SLEEP_MILLIS = "install_carrier_app_notification_sleep_millis";
field public static final java.lang.String OTA_DISABLE_AUTOMATIC_UPDATE = "ota_disable_automatic_update";
field public static final java.lang.String THEATER_MODE_ON = "theater_mode_on";
field public static final java.lang.String WEBVIEW_MULTIPROCESS = "webview_multiprocess";

View File

@@ -12096,6 +12096,28 @@ public final class Settings {
public static final String ENABLE_GNSS_RAW_MEAS_FULL_TRACKING =
"enable_gnss_raw_meas_full_tracking";
/**
* Whether the notification should be ongoing (persistent) when a carrier app install is
* required.
*
* The value is a boolean (1 or 0).
* @hide
*/
@SystemApi
public static final String INSTALL_CARRIER_APP_NOTIFICATION_PERSISTENT =
"install_carrier_app_notification_persistent";
/**
* The amount of time (ms) to hide the install carrier app notification after the user has
* ignored it. After this time passes, the notification will be shown again
*
* The value is a long
* @hide
*/
@SystemApi
public static final String INSTALL_CARRIER_APP_NOTIFICATION_SLEEP_MILLIS =
"install_carrier_app_notification_sleep_millis";
/**
* Whether we've enabled zram on this device. Takes effect on
* reboot. The value "1" enables zram; "0" disables it, and

View File

@@ -422,6 +422,8 @@ message GlobalSettingsProto {
optional SettingProto enable_deletion_helper_no_threshold_toggle = 340 [ (android.privacy).dest = DEST_AUTOMATIC ];
optional SettingProto notification_snooze_options = 341 [ (android.privacy).dest = DEST_AUTOMATIC ];
optional SettingProto enable_gnss_raw_meas_full_tracking = 346 [ (android.privacy).dest = DEST_AUTOMATIC ];
optional SettingProto install_carrier_app_notification_persistent = 356 [ (android.privacy).dest = DEST_AUTOMATIC ];
optional SettingProto install_carrier_app_notification_sleep_millis = 357 [ (android.privacy).dest = DEST_AUTOMATIC ];
optional SettingProto zram_enabled = 347 [ (android.privacy).dest = DEST_AUTOMATIC ];
optional SettingProto smart_replies_in_notifications_flags = 348 [ (android.privacy).dest = DEST_AUTOMATIC ];
optional SettingProto show_first_crash_dialog = 349 [ (android.privacy).dest = DEST_AUTOMATIC ];

View File

@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="21dp"
android:viewportWidth="20"
android:viewportHeight="21">
<group
android:translateX="-31.000000"
android:translateY="-77.000000">
<group
android:translateX="24.000000"
android:translateY="72.000000">
<path
android:fillType="evenOdd"
android:strokeWidth="1"
android:pathData="M 0 0 H 32 V 32 H 0 V 0 Z" />
<path
android:fillColor="#4285F4"
android:strokeWidth="1"
android:pathData="M23,5 L27,5 L27,26 L23,26 L23,5 Z M7,18.125 L11,18.125 L11,26 L7,26 L7,18.125 Z
M15,11.5625 L19,11.5625 L19,26 L15,26 L15,11.5625 Z" />
</group>
</group>
</vector>

View File

@@ -2328,6 +2328,10 @@
<string name="config_customVpnAlwaysOnDisconnectedDialogComponent" translatable="false"
>com.android.vpndialogs/com.android.vpndialogs.AlwaysOnDisconnectedDialog</string>
<!-- Name of the dialog that is used to install the carrier app when the SIM is inserted -->
<string name="config_carrierAppInstallDialogComponent" translatable="false"
>com.android.simappdialog/com.android.simappdialog.InstallCarrierAppActivity</string>
<!-- Apps that are authorized to access shared accounts, overridden by product overlays -->
<string name="config_appsAuthorizedForSharedAccounts" translatable="false">;com.android.settings;</string>

View File

@@ -182,6 +182,8 @@
<string name="notification_channel_voice_mail">Voicemail messages</string>
<!-- Telephony notification channel name for a channel containing wifi calling status notifications. -->
<string name="notification_channel_wfc">Wi-Fi calling</string>
<!-- Telephony notification channel name for a channel containing SIM notifications -->
<string name="notification_channel_sim">SIM status</string>
<!-- Displayed to tell the user that peer changed TTY mode -->
<string name="peerTtyModeFull">Peer requested TTY Mode FULL</string>
@@ -3194,10 +3196,12 @@
<!-- See SIM_ADDED_DIALOG. This is the button of that dialog. -->
<string name="sim_restart_button">Restart</string>
<!-- See Carrier_App_Dialog. This is the message of that dialog. -->
<string name="carrier_app_dialog_message">To get your new SIM working properly, you\'ll need to install and open an app from your carrier.</string>
<!-- See Carrier_App_Dialog. This is the button of that dialog. -->
<string name="carrier_app_dialog_button">GET THE APP</string>
<string name="carrier_app_dialog_not_now">NOT NOW</string>
<string name="install_carrier_app_notification_title">Activate mobile service</string>
<string name="install_carrier_app_notification_text">
Download the carrier app to activate your new SIM
</string>
<!-- See Carrier_App_Notification. This is the button of that dialog. -->
<string name="install_carrier_app_notification_button">Download app</string>
<!-- See carrier_app_notification. This is the headline. -->
<string name="carrier_app_notification_title">New SIM inserted</string>
<string name="carrier_app_notification_text">Tap to set it up</string>

View File

@@ -574,6 +574,7 @@
<java-symbol type="string" name="notification_channel_sms" />
<java-symbol type="string" name="notification_channel_voice_mail" />
<java-symbol type="string" name="notification_channel_wfc" />
<java-symbol type="string" name="notification_channel_sim" />
<java-symbol type="string" name="SetupCallDefault" />
<java-symbol type="string" name="accept" />
<java-symbol type="string" name="activity_chooser_view_see_all" />
@@ -1383,6 +1384,7 @@
<java-symbol type="drawable" name="ic_sim_card_multi_24px_clr" />
<java-symbol type="drawable" name="ic_sim_card_multi_48px_clr" />
<java-symbol type="drawable" name="ic_signal_cellular_alt_24px" />
<java-symbol type="drawable" name="stat_notify_mmcc_indication_icn" />
<java-symbol type="drawable" name="autofilled_highlight"/>
@@ -2072,6 +2074,7 @@
<java-symbol type="string" name="config_customAdbPublicKeyConfirmationSecondaryUserComponent" />
<java-symbol type="string" name="config_customVpnConfirmDialogComponent" />
<java-symbol type="string" name="config_customVpnAlwaysOnDisconnectedDialogComponent" />
<java-symbol type="string" name="config_carrierAppInstallDialogComponent" />
<java-symbol type="string" name="config_defaultNetworkScorerPackageName" />
<java-symbol type="string" name="config_persistentDataPackageName" />
@@ -2771,9 +2774,9 @@
<java-symbol type="array" name="resolver_target_actions_pin" />
<java-symbol type="array" name="resolver_target_actions_unpin" />
<java-symbol type="string" name="carrier_app_dialog_message" />
<java-symbol type="string" name="carrier_app_dialog_button" />
<java-symbol type="string" name="carrier_app_dialog_not_now" />
<java-symbol type="string" name="install_carrier_app_notification_title" />
<java-symbol type="string" name="install_carrier_app_notification_text" />
<java-symbol type="string" name="install_carrier_app_notification_button" />
<java-symbol type="string" name="carrier_app_notification_title" />
<java-symbol type="string" name="carrier_app_notification_text" />
<java-symbol type="string" name="negative_duration" />

View File

@@ -402,6 +402,8 @@ public class SettingsBackupTest {
Settings.Global.GPU_DEBUG_APP,
Settings.Global.GPU_DEBUG_LAYERS,
Settings.Global.ENABLE_GNSS_RAW_MEAS_FULL_TRACKING,
Settings.Global.INSTALL_CARRIER_APP_NOTIFICATION_PERSISTENT,
Settings.Global.INSTALL_CARRIER_APP_NOTIFICATION_SLEEP_MILLIS,
Settings.Global.NETWORK_ACCESS_TIMEOUT_MS,
Settings.Global.WARNING_TEMPERATURE,
Settings.Global.WEBVIEW_DATA_REDUCTION_PROXY_KEY,

View File

@@ -870,6 +870,12 @@ class SettingsProtoDumpUtil {
dumpSetting(s, p,
Settings.Global.ENABLE_GNSS_RAW_MEAS_FULL_TRACKING,
GlobalSettingsProto.ENABLE_GNSS_RAW_MEAS_FULL_TRACKING);
dumpSetting(s, p,
Settings.Global.INSTALL_CARRIER_APP_NOTIFICATION_PERSISTENT,
GlobalSettingsProto.INSTALL_CARRIER_APP_NOTIFICATION_PERSISTENT);
dumpSetting(s, p,
Settings.Global.INSTALL_CARRIER_APP_NOTIFICATION_SLEEP_MILLIS,
GlobalSettingsProto.INSTALL_CARRIER_APP_NOTIFICATION_SLEEP_MILLIS);
// Settings.Global.SHOW_PROCESSES intentionally excluded since it's deprecated.
dumpSetting(s, p,
Settings.Global.LOW_POWER_MODE,

View File

@@ -0,0 +1,18 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := SimAppDialog
LOCAL_CERTIFICATE := platform
LOCAL_STATIC_ANDROID_LIBRARIES := \
android-support-v4
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
include frameworks/opt/setupwizard/library/common-platform-deprecated.mk
include $(BUILD_PACKAGE)

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
* Copyright (C) 2018 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.
*/
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.simappdialog">
<application android:label="@string/app_name">
<activity
android:name=".InstallCarrierAppActivity"
android:exported="true"
android:permission="android.permission.NETWORK_SETTINGS"
android:theme="@style/SuwThemeGlif.Light">
</activity>
</application>
</manifest>

View File

@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="21dp"
android:height="22dp"
android:viewportWidth="21"
android:viewportHeight="22">
<group
android:translateX="-196.000000"
android:translateY="-77.000000">
<group
android:translateX="190.000000"
android:translateY="72.000000">
<path
android:fillType="evenOdd"
android:strokeWidth="1"
android:pathData="M 0 0 H 32 V 32 H 0 V 0 Z"/>
<group
android:translateX="6.666667"
android:translateY="5.333333">
<path
android:fillColor="#4285F4"
android:strokeWidth="1"
android:pathData="M 17 0 L 19 0 Q 20 0 20 1 L 20 20.3333333 Q 20 21.3333333 19 21.3333333 L 17 21.3333333 Q 16 21.3333333 16 20.3333333 L 16 1 Q 16 0 17 0 Z"/>
<path
android:fillColor="#4285F4"
android:strokeWidth="1"
android:pathData="M 1 13.3333333 L 3 13.3333333 Q 4 13.3333333 4 14.3333333 L 4 20.3333333 Q 4 21.3333333 3 21.3333333 L 1 21.3333333 Q 0 21.3333333 0 20.3333333 L 0 14.3333333 Q 0 13.3333333 1 13.3333333 Z"/>
<path
android:fillColor="#4285F4"
android:strokeWidth="1"
android:pathData="M 9 6.66666667 L 11 6.66666667 Q 12 6.66666667 12 7.66666667 L 12 20.33333337 Q 12 21.33333337 11 21.33333337 L 9 21.33333337 Q 8 21.33333337 8 20.33333337 L 8 7.66666667 Q 8 6.66666667 9 6.66666667 Z"/>
</group>
</group>
</group>
</vector>

View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2018 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.
-->
<!-- TODO(b/72511181): replace when illustration is finished -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="270dp"
android:height="270dp"
android:viewportHeight="270.0"
android:viewportWidth="270.0">
<path android:fillColor="#E8EAED"
android:pathData="M183.54,265H84.88c-7.63,0 -13.81,-6.18 -13.81,-13.81V18.81C71.07,11.18 77.25,5 84.88,5h98.66c7.63,0 13.81,6.18 13.81,13.81v232.38C197.35,258.82 191.17,265 183.54,265z"/>
<path android:fillColor="#BDC1C6"
android:pathData="M183.54,6.63c6.72,0 12.18,5.46 12.18,12.18v232.38c0,6.72 -5.46,12.18 -12.18,12.18H84.88c-6.72,0 -12.18,-5.46 -12.18,-12.18V18.81c0,-6.72 5.46,-12.18 12.18,-12.18H183.54M183.54,5H84.88c-7.63,0 -13.81,6.18 -13.81,13.81v232.38c0,7.63 6.18,13.81 13.81,13.81h98.66c7.63,0 13.81,-6.18 13.81,-13.81V18.81C197.35,11.18 191.17,5 183.54,5L183.54,5z"/>
<path android:fillColor="#FFFFFF"
android:pathData="M186.34,243.74H82.08c-2.41,0 -4.36,-1.95 -4.36,-4.36V30.61c0,-2.41 1.95,-4.36 4.36,-4.36h104.26c2.41,0 4.36,1.95 4.36,4.36v208.78C190.7,241.79 188.75,243.74 186.34,243.74z"/>
<path android:fillColor="#BDC1C6"
android:pathData="M156.07,254.78h-43.72c-0.65,0 -1.18,-0.53 -1.18,-1.18v-0.08c0,-0.65 0.53,-1.18 1.18,-1.18h43.72c0.65,0 1.18,0.53 1.18,1.18v0.08C157.25,254.25 156.72,254.78 156.07,254.78z"/>
<path android:fillColor="#BDC1C6"
android:pathData="M156.07,17.67h-43.72c-0.65,0 -1.18,-0.53 -1.18,-1.18V16.4c0,-0.65 0.53,-1.18 1.18,-1.18l43.72,0c0.65,0 1.18,0.53 1.18,1.18v0.08C157.25,17.14 156.72,17.67 156.07,17.67z"/>
<path android:fillColor="#BDC1C6"
android:pathData="M197.85,84.16h-0.5V67.51h0.5c0.6,0 1.08,0.48 1.08,1.08v14.5C198.93,83.68 198.45,84.16 197.85,84.16z"/>
<path android:fillColor="#BDC1C6"
android:pathData="M197.41,136.45h-0.06v-32.87h0.06c0.84,0 1.52,0.68 1.52,1.52v29.84C198.93,135.77 198.25,136.45 197.41,136.45z"/>
<path android:fillColor="#BDC1C6"
android:pathData="M119.3,74.73l2.71,2.71c6.74,-6.74 17.67,-6.74 24.4,0l2.71,-2.71C140.89,66.49 127.54,66.49 119.3,74.73zM130.15,85.57l4.07,4.07l4.07,-4.07C136.04,83.33 132.39,83.33 130.15,85.57zM124.72,80.15l2.71,2.71c3.74,-3.74 9.82,-3.74 13.56,0l2.71,-2.71C138.46,74.91 129.96,74.91 124.72,80.15z"/>
<path android:fillColor="#BDC1C6"
android:pathData="M143.7,179h-1.36v-2.71h-2.71V179h-10.85v-2.71h-2.71V179h-1.36c-1.5,0 -2.7,1.21 -2.7,2.71l-0.01,18.98c0,1.5 1.21,2.71 2.71,2.71h18.98c1.5,0 2.71,-1.21 2.71,-2.71v-18.98C146.41,180.22 145.2,179 143.7,179zM143.7,200.7h-18.98v-14.91h18.98V200.7zM127.43,188.49h6.78v6.78h-6.78V188.49z"/>
<path android:fillColor="#BDC1C6"
android:pathData="M146.41,144.49v-18.98c0,-1.5 -1.21,-2.71 -2.71,-2.71h-18.98c-1.5,0 -2.71,1.21 -2.71,2.71v18.98c0,1.5 1.21,2.71 2.71,2.71h18.98C145.2,147.2 146.41,145.99 146.41,144.49zM129.47,137.03l3.39,4.07l4.75,-6.11l6.1,8.13h-18.98L129.47,137.03z"/>
</vector>

View File

@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018 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.
-->
<com.android.setupwizardlib.GlifLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/setup_wizard_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:icon="@drawable/ic_signal_cellular_alt_rounded_24px"
app:suwHeaderText="@string/install_carrier_app_title"
app:suwFooter="@layout/install_carrier_app_footer">
<LinearLayout
style="@style/SuwContentFrame"
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/install_carrier_app_description"
style="@style/SuwDescription.Glif"
android:text="@string/install_carrier_app_description_default"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<com.android.setupwizardlib.view.FillContentLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<!-- TODO(b/72511181): final illo and content description update -->
<ImageView
android:src="@drawable/placeholder"
style="@style/SuwContentIllustration"
android:contentDescription="@null"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</com.android.setupwizardlib.view.FillContentLayout>
</LinearLayout>
</com.android.setupwizardlib.GlifLayout>

View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018 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.
-->
<com.android.setupwizardlib.view.ButtonBarLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/footer"
style="@style/SuwGlifButtonBar.Stackable"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/skip_button"
style="@style/SuwGlifButton.Secondary"
android:text="@string/install_carrier_app_defer_action"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Space
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"/>
<Button
android:id="@+id/download_button"
style="@style/SuwGlifButton.Primary"
android:text="@string/install_carrier_app_download_action"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</com.android.setupwizardlib.view.ButtonBarLayout>

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2018 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.
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- TODO character limits -->
<!-- The name of this application -->
<string name="app_name">Sim App Dialog</string>
<!-- Install Carrier App Activity -->
<!-- Title of screen asking user to download the carrier app to match the inserted SIM card -->
<string name="install_carrier_app_title">Activate mobile service</string>
<!-- Description of screen asking user to download the carrier app to match the inserted SIM card if we know the name of the carrier-->
<string name="install_carrier_app_description">To get your new SIM working properly, you\'ll
need to install the <xliff:g name="carrier_name" example="Project Fi">%1$s</xliff:g> app
</string>
<!-- Description of screen asking user to download the carrier app to match the inserted SIM card if we don't know the name of the carrier-->
<string name="install_carrier_app_description_default">To get your new SIM working properly,
you\'ll need to install the carrier app
</string>
<!-- Name of the button used to defer downloading the carrier app -->
<string name="install_carrier_app_defer_action">Not now</string>
<!-- Name of the button for downloading the carrier app -->
<string name="install_carrier_app_download_action">Download app</string>
</resources>

View File

@@ -0,0 +1,95 @@
/*
* Copyright (C) 2018 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.
*/
package com.android.simappdialog;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.SystemProperties;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.android.setupwizardlib.util.WizardManagerHelper;
/**
* Activity that gives a user the choice to download the SIM app or defer until a later time
*
* Will finish with result {@link #DEFER_RESULT} on defer button press or {@link #DOWNLOAD_RESULT}
* if the download button is pressed
*
* Can display the carrier app name if its passed into the intent with key
* {@link #BUNDLE_KEY_CARRIER_NAME}
*/
public class InstallCarrierAppActivity extends Activity implements View.OnClickListener {
/**
* Key for the carrier app name that will be displayed as the app to download. If unset, a
* default description will be used
*/
public static final String BUNDLE_KEY_CARRIER_NAME = "carrier_name";
/** Result code when the defer button is pressed */
public static final int DEFER_RESULT = 1;
/** Result code when the download button is pressed */
public static final int DOWNLOAD_RESULT = 2;
@Override
protected void onCreate(Bundle icicle) {
// Setup theme for aosp/pixel
setTheme(
WizardManagerHelper.getThemeRes(
SystemProperties.get("setupwizard.theme"),
R.style.SuwThemeGlif_Light
)
);
super.onCreate(icicle);
setContentView(R.layout.install_carrier_app_activity);
Button notNowButton = findViewById(R.id.skip_button);
notNowButton.setOnClickListener(this);
Button downloadButton = findViewById(R.id.download_button);
downloadButton.setOnClickListener(this);
// Include carrier name in description text if its present in the intent
Intent intent = getIntent();
if (intent != null) {
String carrierName = intent.getStringExtra(BUNDLE_KEY_CARRIER_NAME);
if (!TextUtils.isEmpty(carrierName)) {
TextView subtitle = findViewById(R.id.install_carrier_app_description);
subtitle.setText(getString(R.string.install_carrier_app_description, carrierName));
}
}
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.skip_button:
finish(DEFER_RESULT);
break;
case R.id.download_button:
finish(DOWNLOAD_RESULT);
break;
}
}
private void finish(int resultCode) {
setResult(resultCode);
finish();
}
}