[Catalyst] Fix the getPreferenceHierarchy can't be executed

- Implement the getPreferenceScreenBindingArgs for parameterized page.

NO_IFTTT=Catalyst only

Fixes: 419310279
Test: atest
Flag: com.android.settings.flags.deeplink_network_and_internet_25q4
Change-Id: If63c740ffafe0fdd4f3a1baca04815beec674376
diff --git a/src/com/android/settings/network/MobileNetworkListScreen.kt b/src/com/android/settings/network/MobileNetworkListScreen.kt
index e8eaece..1ca4bef 100644
--- a/src/com/android/settings/network/MobileNetworkListScreen.kt
+++ b/src/com/android/settings/network/MobileNetworkListScreen.kt
@@ -177,6 +177,9 @@
 
     override fun fragmentClass(): Class<out Fragment>? = MobileNetworkListFragment::class.java
 
+    // Please refer to this link (https://b.corp.google.com/issues/419310279#comment11).
+    // This hierarchical UI won't be shown while the MobileNetworkListFragment finished.
+    // Keep it for the external apps may retrieve it through the Setting Graph.
     override fun getPreferenceHierarchy(context: Context, coroutineScope: CoroutineScope) =
         preferenceHierarchy(context) {
             +MobileDataPreference()
diff --git a/src/com/android/settings/network/telephony/MobileNetworkSettings.java b/src/com/android/settings/network/telephony/MobileNetworkSettings.java
index 08f93cf..5e566a7 100644
--- a/src/com/android/settings/network/telephony/MobileNetworkSettings.java
+++ b/src/com/android/settings/network/telephony/MobileNetworkSettings.java
@@ -554,5 +554,41 @@
     public @Nullable String getPreferenceScreenBindingKey(@NonNull Context context) {
         return MobileNetworkScreen.KEY;
     }
+
+    @Override
+    public @Nullable Bundle getPreferenceScreenBindingArgs(@NonNull Context context) {
+        final Bundle bundle = new Bundle();
+        bundle.putInt(Settings.EXTRA_SUB_ID, getSubId());
+        return bundle;
+    }
+
+    private int getSubId() {
+        int retSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
+        if (getArguments() == null) {
+            Intent intent = getIntent();
+            if (intent != null) {
+                retSubId = intent.getIntExtra(Settings.EXTRA_SUB_ID,
+                        MobileNetworkUtils.getSearchableSubscriptionId(getContext()));
+            } else {
+                Log.d(LOG_TAG, "getSubId: intent is null, can not get subId " + retSubId
+                        + " from intent.");
+            }
+        } else {
+            retSubId = getArguments().getInt(Settings.EXTRA_SUB_ID,
+                    MobileNetworkUtils.getSearchableSubscriptionId(getContext()));
+        }
+        if (retSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
+            Log.d(LOG_TAG, "getSubId: Invalid subId, get the default subscription to show.");
+            SubscriptionInfo info = SubscriptionUtil.getSubscriptionOrDefault(getContext(),
+                    retSubId);
+            if (info == null) {
+                Log.d(LOG_TAG, "getSubId: Invalid subId request " + retSubId);
+            } else {
+                retSubId = info.getSubscriptionId();
+            }
+        }
+        Log.d(LOG_TAG, "getSubId: Result subId : " + retSubId);
+        return retSubId;
+    }
 }
 // LINT.ThenChange(MobileNetworkScreen.kt)
\ No newline at end of file