diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2021-05-28 01:08:25 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2021-05-28 01:08:25 +0000 |
commit | 3dcb2450e422f6b0c07ceca25842debb0a2322a5 (patch) | |
tree | fb5d820aaf2fe5444c085f6ff04a0b4fa41e17cd | |
parent | 4eb59b2a9558d64b9f6fd01838eb9b4e237b8166 (diff) | |
parent | 02e835e4d40e225df9ac88a34d71827cd33274fa (diff) | |
download | ImsServiceEntitlement-3dcb2450e422f6b0c07ceca25842debb0a2322a5.tar.gz |
Snap for 7406169 from 02e835e4d40e225df9ac88a34d71827cd33274fa to sc-d1-release
Change-Id: I9ea73479c508fd4820d45c83a899141364e886fb
6 files changed, 12 insertions, 36 deletions
diff --git a/src/com/android/imsserviceentitlement/ImsEntitlementApi.java b/src/com/android/imsserviceentitlement/ImsEntitlementApi.java index 0bc8205..c5c09cb 100644 --- a/src/com/android/imsserviceentitlement/ImsEntitlementApi.java +++ b/src/com/android/imsserviceentitlement/ImsEntitlementApi.java @@ -42,7 +42,6 @@ import com.google.common.collect.ImmutableList; public class ImsEntitlementApi { private static final String TAG = "IMSSE-ImsEntitlementApi"; - private static final String JS_CONTROLLER_NAME = "VoWiFiWebServiceFlow"; private static final int RESPONSE_TOKEN_EXPIRED = 511; private static final int AUTHENTICATION_RETRIES = 1; @@ -142,9 +141,4 @@ public class ImsEntitlementApi { String entitlementServiceUrl = TelephonyUtils.getEntitlementServerUrl(context, mSubId); return CarrierConfig.builder().setServerUrl(entitlementServiceUrl).build(); } - - /** Returns the name of JS controller object used in emergency address webview. */ - public String getWebviewJsControllerName() { - return JS_CONTROLLER_NAME; - } } diff --git a/src/com/android/imsserviceentitlement/WfcActivationActivity.java b/src/com/android/imsserviceentitlement/WfcActivationActivity.java index 821a506..c75bebc 100644 --- a/src/com/android/imsserviceentitlement/WfcActivationActivity.java +++ b/src/com/android/imsserviceentitlement/WfcActivationActivity.java @@ -89,14 +89,11 @@ public class WfcActivationActivity extends FragmentActivity implements WfcActiva } @Override - public boolean showWebview(String url, String postData, String jsControllerName) { + public boolean showWebview(String url, String postData) { runOnUiThreadIfAlive( () -> { FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); - mWfcWebPortalFragment = WfcWebPortalFragment.newInstance( - url, - postData, - jsControllerName); + mWfcWebPortalFragment = WfcWebPortalFragment.newInstance(url, postData); ft.replace(R.id.wfc_activation_container, mWfcWebPortalFragment); // commit may be executed after activity's state is saved. ft.commitAllowingStateLoss(); diff --git a/src/com/android/imsserviceentitlement/WfcActivationController.java b/src/com/android/imsserviceentitlement/WfcActivationController.java index 0baf204..4ffbcb7 100644 --- a/src/com/android/imsserviceentitlement/WfcActivationController.java +++ b/src/com/android/imsserviceentitlement/WfcActivationController.java @@ -238,14 +238,11 @@ public class WfcActivationController { if (vowifiStatus.serverDataMissing()) { if (!TextUtils.isEmpty(result.getTermsAndConditionsWebUrl())) { mActivationUi.showWebview( - result.getTermsAndConditionsWebUrl(), - /* postData= */ null, - mImsEntitlementApi.getWebviewJsControllerName()); + result.getTermsAndConditionsWebUrl(), /* postData= */ null); } else { mActivationUi.showWebview( result.getEmergencyAddressWebUrl(), - result.getEmergencyAddressWebData(), - mImsEntitlementApi.getWebviewJsControllerName()); + result.getEmergencyAddressWebData()); } } else if (vowifiStatus.incompatible()) { finishStatsLog(IMS_SERVICE_ENTITLEMENT_UPDATED__APP_RESULT__INCOMPATIBLE); @@ -265,14 +262,10 @@ public class WfcActivationController { int launchIntention = ActivityConstants.getLaunchIntention(mStartIntent); if (launchIntention == ActivityConstants.LAUNCH_APP_SHOW_TC) { mActivationUi.showWebview( - result.getTermsAndConditionsWebUrl(), - /* postData= */ null, - mImsEntitlementApi.getWebviewJsControllerName()); + result.getTermsAndConditionsWebUrl(), /* postData= */ null); } else { mActivationUi.showWebview( - result.getEmergencyAddressWebUrl(), - result.getEmergencyAddressWebData(), - mImsEntitlementApi.getWebviewJsControllerName()); + result.getEmergencyAddressWebUrl(), result.getEmergencyAddressWebData()); } } else { if (vowifiStatus.incompatible()) { diff --git a/src/com/android/imsserviceentitlement/WfcActivationUi.java b/src/com/android/imsserviceentitlement/WfcActivationUi.java index 058d308..259b17f 100644 --- a/src/com/android/imsserviceentitlement/WfcActivationUi.java +++ b/src/com/android/imsserviceentitlement/WfcActivationUi.java @@ -35,7 +35,7 @@ public interface WfcActivationUi { @StringRes int secondaryButtonText); /** Shows the full screen webview */ - boolean showWebview(String url, String postData, String jsControllerName); + boolean showWebview(String url, String postData); /** * Finishes the activity with {@code result}: diff --git a/src/com/android/imsserviceentitlement/WfcWebPortalFragment.java b/src/com/android/imsserviceentitlement/WfcWebPortalFragment.java index e905133..8f3af88 100644 --- a/src/com/android/imsserviceentitlement/WfcWebPortalFragment.java +++ b/src/com/android/imsserviceentitlement/WfcWebPortalFragment.java @@ -39,22 +39,20 @@ public class WfcWebPortalFragment extends Fragment { private static final String KEY_URL_STRING = "url"; private static final String KEY_POST_DATA_STRING = "post_data"; - private static final String KEY_JS_CALLBACK_OBJECT_STRING = "js_callback_object"; - + // Javascript object associated with the webview callback functions. See TS.43 v5.0 section 3.4 + private static final String JS_CONTROLLER_NAME = "VoWiFiWebServiceFlow"; private static final String URL_WITH_PDF_FILE_EXTENSION = ".pdf"; private WebView mWebView; private boolean mFinishFlow = false; /** Public static constructor */ - public static WfcWebPortalFragment newInstance( - String url, String postData, String jsControllerName) { + public static WfcWebPortalFragment newInstance(String url, String postData) { WfcWebPortalFragment frag = new WfcWebPortalFragment(); Bundle args = new Bundle(); args.putString(KEY_URL_STRING, url); args.putString(KEY_POST_DATA_STRING, postData); - args.putString(KEY_JS_CALLBACK_OBJECT_STRING, jsControllerName); frag.setArguments(args); return frag; @@ -69,7 +67,6 @@ public class WfcWebPortalFragment extends Fragment { Log.d(TAG, "Webview arguments: " + arguments); String url = arguments.getString(KEY_URL_STRING, ""); String postData = arguments.getString(KEY_POST_DATA_STRING, ""); - String jsCallbackObject = arguments.getString(KEY_JS_CALLBACK_OBJECT_STRING, ""); ProgressBar spinner = v.findViewById(R.id.loadingbar); mWebView = v.findViewById(R.id.webview); @@ -106,7 +103,7 @@ public class WfcWebPortalFragment extends Fragment { } } }); - mWebView.addJavascriptInterface(new JsInterface(getActivity()), jsCallbackObject); + mWebView.addJavascriptInterface(new JsInterface(getActivity()), JS_CONTROLLER_NAME); WebSettings settings = mWebView.getSettings(); settings.setDomStorageEnabled(true); settings.setJavaScriptEnabled(true); diff --git a/tests/unittests/src/com/android/imsserviceentitlement/WfcActivationControllerTest.java b/tests/unittests/src/com/android/imsserviceentitlement/WfcActivationControllerTest.java index 707f5d1..bd78b14 100644 --- a/tests/unittests/src/com/android/imsserviceentitlement/WfcActivationControllerTest.java +++ b/tests/unittests/src/com/android/imsserviceentitlement/WfcActivationControllerTest.java @@ -75,7 +75,6 @@ public class WfcActivationControllerTest { public void setUp() throws Exception { mContext = spy(ApplicationProvider.getApplicationContext()); - when(mActivationApi.getWebviewJsControllerName()).thenReturn(WEBVIEW_JS_CONTROLLER_NAME); when(mContext.getSystemService(TelephonyManager.class)).thenReturn(mTelephonyManager); when(mTelephonyManager.createForSubscriptionId(SUB_ID)).thenReturn(mTelephonyManager); setNetworkConnected(true); @@ -193,11 +192,7 @@ public class WfcActivationControllerTest { mWfcActivationController.evaluateEntitlementStatus(); - verify(mActivationUi) - .showWebview( - EMERGENCY_ADDRESS_WEB_URL, - EMERGENCY_ADDRESS_WEB_DATA, - WEBVIEW_JS_CONTROLLER_NAME); + verify(mActivationUi).showWebview(EMERGENCY_ADDRESS_WEB_URL, EMERGENCY_ADDRESS_WEB_DATA); } @Test |