Show the storage settings when tapping on upsell notification.

Bug: 31621740
Test: com.android.storagemanager.automatic.DEBUG_SHOW_NOTIFICATION will show the notification for
manual testing.
Change-Id: Icbfb875a68cc8f2ce64730d40f541ec4ca975dbd
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index c25d21d..ac51041 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -68,7 +68,9 @@
                 <action android:name="com.android.storagemanager.automatic.DISMISS" />
                 <action android:name="com.android.storagemanager.automatic.ACTIVATE" />
                 <action android:name="com.android.storagemanager.automatic.NO_THANKS" />
-                <action android:name="com.android.storagemanager.automatic.DEBUG_SHOW_NOTIFICATION" />
+                <action android:name="com.android.storagemanager.automatic.SHOW_NOTIFICATION" />
+                <action android:name="com.android.storagemanager.automatic.DEBUG_SHOW_NOTIFICATION"/>
+                <action android:name="com.android.storagemanager.automatic.SHOW_SETTINGS" />
             </intent-filter>
         </receiver>
 
diff --git a/src/com/android/storagemanager/automatic/NotificationController.java b/src/com/android/storagemanager/automatic/NotificationController.java
index dc20bbe..9c48b43 100644
--- a/src/com/android/storagemanager/automatic/NotificationController.java
+++ b/src/com/android/storagemanager/automatic/NotificationController.java
@@ -53,14 +53,19 @@
     public static final String INTENT_ACTION_NO_THANKS =
             "com.android.storagemanager.automatic.NO_THANKS";
 
-
     /**
-     * Intent action for if the user explicitly hits "No thanks" on the notification.
+     * Intent action for forcefully showing the notification, even if the conditions are not valid.
      */
     private static final String INTENT_ACTION_DEBUG_NOTIFICATION =
             "com.android.storagemanager.automatic.DEBUG_SHOW_NOTIFICATION";
 
     /**
+     * Intent action for if the user taps on the notification.
+     */
+    private static final String INTENT_ACTION_TAP =
+            "com.android.storagemanager.automatic.SHOW_SETTINGS";
+
+    /**
      * Intent extra for the notification id.
      */
     public static final String INTENT_EXTRA_ID = "id";
@@ -91,6 +96,11 @@
             case INTENT_ACTION_DEBUG_NOTIFICATION:
                 showNotification(context);
                 return;
+            case INTENT_ACTION_TAP:
+                Intent storageIntent = new Intent(Settings.ACTION_STORAGE_MANAGER_SETTINGS);
+                storageIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+                context.startActivity(storageIntent);
+                break;
         }
         cancelNotification(context, intent);
     }
@@ -143,6 +153,11 @@
                 new Intent(INTENT_ACTION_DISMISS),
                 PendingIntent.FLAG_ONE_SHOT);
 
+        Intent contentIntent = new Intent(INTENT_ACTION_TAP);
+        contentIntent.putExtra(INTENT_EXTRA_ID, NOTIFICATION_ID);
+        PendingIntent tapIntent = PendingIntent.getBroadcast(context, 0,  contentIntent,
+                PendingIntent.FLAG_ONE_SHOT);
+
         Notification.Builder builder = new Notification.Builder(context)
                 .setSmallIcon(R.drawable.ic_settings_24dp)
                 .setContentTitle(
@@ -153,6 +168,7 @@
                         res.getString(R.string.automatic_storage_manager_notification_summary)))
                 .addAction(cancelAction.build())
                 .addAction(activateAutomaticAction.build())
+                .setContentIntent(tapIntent)
                 .setDeleteIntent(deleteIntent);
 
         NotificationManager manager =