Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e4dd9fee authored by Sarah Chin's avatar Sarah Chin
Browse files

Resolve API feedback and remove references to SliceStore

Rename PURCHASE_PREMIUM_CAPABILITY_RESULT_NOT_DEFAULT_DATA to
PURCHASE_PREMIUM_CAPABILITY_RESULT_NOT_DEFAULT_DATA_SUB

Split KEY_PREMIUM_CAPABILITY_MAXIMUM_NOTIFICATION_COUNT_INT_ARRAY
into KEY_PREMIUM_CAPABILITY_MAXIMUM_DAILY_NOTIFICATION_COUNT_INT
and KEY_PREMIUM_CAPABILITY_MAXIMUM_MONTHLY_NOTIFICATION_COUNT_INT

Rename SliceStore to SlicePurchaseController. Remove all references to
SliceStore.

Test: atest TelephonyManagerReadNonDangerousPermissionTest
Test: manually verify premium capability purchase behavior
Bug: 255552152
Change-Id: I653db7566c91942faadcec24fb7bb340236ebdc0
parent 8742dc82
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -41783,7 +41783,8 @@ package android.telephony {
    field public static final String KEY_OPPORTUNISTIC_NETWORK_PING_PONG_TIME_LONG = "opportunistic_network_ping_pong_time_long";
    field public static final String KEY_PING_TEST_BEFORE_DATA_SWITCH_BOOL = "ping_test_before_data_switch_bool";
    field public static final String KEY_PREFER_2G_BOOL = "prefer_2g_bool";
    field public static final String KEY_PREMIUM_CAPABILITY_MAXIMUM_NOTIFICATION_COUNT_INT_ARRAY = "premium_capability_maximum_notification_count_int_array";
    field public static final String KEY_PREMIUM_CAPABILITY_MAXIMUM_DAILY_NOTIFICATION_COUNT_INT = "premium_capability_maximum_daily_notification_count_int";
    field public static final String KEY_PREMIUM_CAPABILITY_MAXIMUM_MONTHLY_NOTIFICATION_COUNT_INT = "premium_capability_maximum_monthly_notification_count_int";
    field public static final String KEY_PREMIUM_CAPABILITY_NETWORK_SETUP_TIME_MILLIS_LONG = "premium_capability_network_setup_time_millis_long";
    field public static final String KEY_PREMIUM_CAPABILITY_NOTIFICATION_BACKOFF_HYSTERESIS_TIME_MILLIS_LONG = "premium_capability_notification_backoff_hysteresis_time_millis_long";
    field public static final String KEY_PREMIUM_CAPABILITY_NOTIFICATION_DISPLAY_TIMEOUT_MILLIS_LONG = "premium_capability_notification_display_timeout_millis_long";
@@ -44090,7 +44091,7 @@ package android.telephony {
    field public static final int PURCHASE_PREMIUM_CAPABILITY_RESULT_FEATURE_NOT_SUPPORTED = 10; // 0xa
    field public static final int PURCHASE_PREMIUM_CAPABILITY_RESULT_NETWORK_CONGESTED = 13; // 0xd
    field public static final int PURCHASE_PREMIUM_CAPABILITY_RESULT_NETWORK_NOT_AVAILABLE = 12; // 0xc
    field public static final int PURCHASE_PREMIUM_CAPABILITY_RESULT_NOT_DEFAULT_DATA = 14; // 0xe
    field public static final int PURCHASE_PREMIUM_CAPABILITY_RESULT_NOT_DEFAULT_DATA_SUB = 14; // 0xe
    field public static final int PURCHASE_PREMIUM_CAPABILITY_RESULT_OVERRIDDEN = 5; // 0x5
    field public static final int PURCHASE_PREMIUM_CAPABILITY_RESULT_PENDING_NETWORK_SETUP = 15; // 0xf
    field public static final int PURCHASE_PREMIUM_CAPABILITY_RESULT_REQUEST_FAILED = 11; // 0xb
+1 −1
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ package {
android_app {
    name: "CarrierDefaultApp",
    srcs: ["src/**/*.java"],
    libs: ["SliceStore"],
    libs: ["SlicePurchaseController"],
    platform_apis: true,
    certificate: "platform",
    optimize: {
+6 −6
Original line number Diff line number Diff line
@@ -73,16 +73,16 @@
            </intent-filter>
        </activity-alias>

        <receiver android:name="com.android.carrierdefaultapp.SliceStoreBroadcastReceiver"
        <receiver android:name="com.android.carrierdefaultapp.SlicePurchaseBroadcastReceiver"
                  android:exported="true">
            <intent-filter>
                <action android:name="com.android.phone.slicestore.action.START_SLICE_STORE" />
                <action android:name="com.android.phone.slicestore.action.SLICE_STORE_RESPONSE_TIMEOUT" />
                <action android:name="com.android.phone.slicestore.action.NOTIFICATION_CANCELED" />
                <action android:name="com.android.phone.slice.action.START_SLICE_PURCHASE_APP" />
                <action android:name="com.android.phone.slice.action.SLICE_PURCHASE_APP_RESPONSE_TIMEOUT" />
                <action android:name="com.android.phone.slice.action.NOTIFICATION_CANCELED" />
            </intent-filter>
        </receiver>
        <activity android:name="com.android.carrierdefaultapp.SliceStoreActivity"
                  android:label="@string/slice_store_label"
        <activity android:name="com.android.carrierdefaultapp.SlicePurchaseActivity"
                  android:label="@string/slice_purchase_app_label"
                  android:exported="true"
                  android:configChanges="keyboardHidden|orientation|screenSize">
            <intent-filter>
+8 −7
Original line number Diff line number Diff line
@@ -20,7 +20,8 @@
    <meta charset="UTF-8">
    <meta name="description" content="
    This is a HTML page that calls and verifies responses from the @JavascriptInterface functions of
    SliceStoreWebInterface. Test SliceStore APIs using ADB shell commands and the APIs below:
    SlicePurchaseWebInterface. Test slice purchase application behavior using ADB shell commands and
    the APIs below:

    FROM TERMINAL:
    Allow device to override carrier configs:
@@ -29,7 +30,7 @@
    $ adb shell cmd phone cc set-value -p supported_premium_capabilities_int_array 34
    Set the carrier purchase URL to this test HTML file:
    $ adb shell cmd phone cc set-value -p premium_capability_purchase_url_string \
      file:///android_asset/slice_store_test.html
      file:///android_asset/slice_purchase_test.html
    OPTIONAL: Allow premium capability purchase on LTE:
    $ adb shell cmd phone cc set-value -p premium_capability_supported_on_lte_bool true
    OPTIONAL: Override ServiceState to fake a NR SA connection:
@@ -43,7 +44,7 @@
            this.getMainExecutor(), request::offer);

    When the test application starts, this HTML will be loaded into the WebView along with the
    associated JavaScript functions in file:///android_asset/slice_store_test.js.
    associated JavaScript functions in file:///android_asset/slice_purchase_test.js.
    Click on the buttons in the HTML to call the corresponding @JavascriptInterface APIs.

    RESET DEVICE STATE:
@@ -52,11 +53,11 @@
    Clear ServiceState override that was set:
    $ adb shell am broadcast -a com.android.internal.telephony.TestServiceState --es action reset
    ">
    <title>Test SliceStoreActivity</title>
    <script type="text/javascript" src="slice_store_test.js"></script>
    <title>Test SlicePurchaseActivity</title>
    <script type="text/javascript" src="slice_purchase_test.js"></script>
</head>
<body>
    <h1>Test SliceStoreActivity</h1>
    <h1>Test SlicePurchaseActivity</h1>
    <h2>Get requested premium capability</h2>
    <button type="button" onclick="testGetRequestedCapability()">
        Get requested premium capability
@@ -70,7 +71,7 @@
    <p id="purchase_successful"></p>

    <h2>Notify purchase failed</h2>
    <button type="button" onclick="testNotifyPurchaseFailed()">
    <button type="button" onclick="testNotifyPurchaseFailed(2, 'FAILURE_CODE_SERVER_UNREACHABLE')">
        Notify purchase failed
    </button>
    <p id="purchase_failed"></p>
+5 −5
Original line number Diff line number Diff line
@@ -15,19 +15,19 @@
 */

function testGetRequestedCapability() {
    let capability = SliceStoreWebInterface.getRequestedCapability();
    let capability = SlicePurchaseWebInterface.getRequestedCapability();
    document.getElementById("requested_capability").innerHTML =
            "Premium capability requested: " + capability;
}

function testNotifyPurchaseSuccessful(duration_ms_long = 0) {
    SliceStoreWebInterface.notifyPurchaseSuccessful(duration);
    SlicePurchaseWebInterface.notifyPurchaseSuccessful(duration_ms_long);
    document.getElementById("purchase_successful").innerHTML =
            "Notified purchase success for duration: " + duration;
            "Notified purchase success for duration: " + duration_ms_long;
}

function testNotifyPurchaseFailed() {
    SliceStoreWebInterface.notifyPurchaseFailed();
function testNotifyPurchaseFailed(failure_code = 0, failure_reason = "unknown") {
    SlicePurchaseWebInterface.notifyPurchaseFailed(failure_code, failure_reason);
    document.getElementById("purchase_failed").innerHTML =
            "Notified purchase failed.";
}
Loading