Merge "Update pip setings stub message"
diff --git a/FrameworkPackageStubs/AndroidManifest.xml b/FrameworkPackageStubs/AndroidManifest.xml
index 75f9821..44a114b 100644
--- a/FrameworkPackageStubs/AndroidManifest.xml
+++ b/FrameworkPackageStubs/AndroidManifest.xml
@@ -114,10 +114,6 @@
                 <action android:name="android.settings.USER_DICTIONARY_SETTINGS"/>
                 <category android:name="android.intent.category.DEFAULT"/>
             </intent-filter>
-            <intent-filter android:priority="-1">
-                <action android:name="android.settings.PICTURE_IN_PICTURE_SETTINGS" />
-                <category android:name="android.intent.category.DEFAULT" />
-            </intent-filter>
         </activity>
 
         <!-- CDD Core Application Intents Stubs -->
@@ -221,11 +217,23 @@
             </intent-filter>
         </activity>
 
+        <!-- Picture in picture settings stub -->
+        <activity android:name=".Stubs$PictureInPictureSettingsStub"
+                  android:label="@string/stub_name"
+                  android:excludeFromRecents="true"
+                  android:exported="true">
+            <intent-filter android:priority="-1">
+                <action android:name="android.settings.PICTURE_IN_PICTURE_SETTINGS" />
+                <category android:name="android.intent.category.DEFAULT" />
+            </intent-filter>
+        </activity>
+
         <!-- Contacts package stubs -->
         <activity
             android:name=".Stubs$ContactsStub"
             android:label="@string/stub_name"
-            android:excludeFromRecents="true">
+            android:excludeFromRecents="true"
+            android:exported="true">
             <intent-filter android:priority="-1">
                 <action android:name="android.intent.action.VIEW" />
                 <category android:name="android.intent.category.DEFAULT" />
diff --git a/FrameworkPackageStubs/res/values/strings.xml b/FrameworkPackageStubs/res/values/strings.xml
index 1446a89..472c85a 100644
--- a/FrameworkPackageStubs/res/values/strings.xml
+++ b/FrameworkPackageStubs/res/values/strings.xml
@@ -7,6 +7,9 @@
     <!-- Toast message displayed when a stub activity is launched. [CHAR LIMIT=NONE] -->
     <string name="message_not_supported">No application can handle this action</string>
 
+    <!-- Toast message displayed for pip settings when pip isn't supported. [CHAR LIMIT=NONE] -->
+    <string name="pip_not_supported">Picture in Picture is not supported on this device</string>
+
     <!-- Stub name [CHAR LIMIT=NONE]-->
     <string name="stub_name">None</string>
 
diff --git a/FrameworkPackageStubs/src/com/android/car/frameworkpackagestubs/Stubs.java b/FrameworkPackageStubs/src/com/android/car/frameworkpackagestubs/Stubs.java
index 3787d71..58d0261 100644
--- a/FrameworkPackageStubs/src/com/android/car/frameworkpackagestubs/Stubs.java
+++ b/FrameworkPackageStubs/src/com/android/car/frameworkpackagestubs/Stubs.java
@@ -17,6 +17,7 @@
 package com.android.car.frameworkpackagestubs;
 
 import android.app.Activity;
+import android.content.pm.PackageManager;
 import android.os.Bundle;
 import android.widget.Toast;
 
@@ -74,6 +75,11 @@
     public static class CalendarStub extends BaseActivity { }
 
     /**
+     * Stub activity for Contacts events.
+     */
+    public static class ContactsStub extends BaseActivity { }
+
+    /**
      * Stub activity for Desk Clock events.
      */
     public static class DeskClockStub extends BaseActivity { }
@@ -112,4 +118,17 @@
      * Stub activity for webview setting.
      */
     public static class WebViewSettingsStub extends BaseActivity { }
+
+    /**
+     * Stub activity for picture in picture settings.
+     */
+    public static class PictureInPictureSettingsStub extends BaseActivity {
+        @Override
+        protected CharSequence getMessage() {
+            if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE)) {
+                return getResources().getString(R.string.pip_not_supported);
+            }
+            return super.getMessage();
+        }
+    }
 }