Remove sub-text from slice builder

We would like to remove all sub-text from Settings Search. But slice
view does not support API to configure the sub-text visibility.
Therefore, the only way is to remove the sub-text from slices directly.

Since Settings slices are also invoked by other apps, we can not
directly remove the sub-text.

Finally, we decide to check the caller's uid. If it comes from Settings
Search, we will return the slice without the sub-text.

Bug: 143118037
Test: visual, robotests
Change-Id: Iac72f1683a2c930592634e0599058890d86f669d
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index e8eb8ba..2391fe8 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -57,6 +57,7 @@
 import android.net.Network;
 import android.net.wifi.WifiManager;
 import android.os.BatteryManager;
+import android.os.Binder;
 import android.os.Build;
 import android.os.Bundle;
 import android.os.IBinder;
@@ -1089,4 +1090,15 @@
         }
         return f;
     }
+
+    /**
+     * Returns true if current binder uid is Settings Intelligence.
+     */
+    public static boolean isSettingsIntelligence(Context context) {
+        final int callingUid = Binder.getCallingUid();
+        final String callingPackage = context.getPackageManager().getPackagesForUid(callingUid)[0];
+        final boolean isSettingsIntelligence = TextUtils.equals(callingPackage,
+                context.getString(R.string.config_settingsintelligence_package_name));
+        return isSettingsIntelligence;
+    }
 }