OSDN Git Service

Fix http://b/2249983 .
authorDaniel Sandler <dsandler@google.com>
Thu, 12 Nov 2009 21:40:19 +0000 (13:40 -0800)
committerDaniel Sandler <dsandler@google.com>
Thu, 12 Nov 2009 21:40:19 +0000 (13:40 -0800)
Place the other activities in Clock in their own task
affinity and hide them from the recent apps list.

Additionally, launch other apps with the new task flag
(since we're behaving like a launcher).

AndroidManifest.xml
src/com/android/deskclock/DeskClock.java

index 25ac74d..b030918 100644 (file)
             </intent-filter>
         </activity>
 
-        <activity android:name="AlarmClock" android:label="@string/alarm_list_title"
-                android:configChanges="orientation|keyboardHidden|keyboard|navigation">
+        <activity android:name="AlarmClock"
+                android:label="@string/alarm_list_title"
+                android:taskAffinity=""
+                android:excludeFromRecents="true"
+                android:configChanges="orientation|keyboardHidden|keyboard|navigation"
+                >
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
             </intent-filter>
         </activity>
 
-        <activity android:name="SettingsActivity" android:label="@string/settings">
+        <activity android:name="SettingsActivity"
+                android:label="@string/settings"
+                android:taskAffinity=""
+                android:excludeFromRecents="true"
+                >
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
             </intent-filter>
index f8b7129..e7060b5 100644 (file)
@@ -630,7 +630,8 @@ public class DeskClock extends Activity {
                     startActivity(new Intent(
                         Intent.ACTION_VIEW,
                         android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI)
-                            .putExtra("slideshow", true));
+                            .putExtra("slideshow", true)
+                            .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
                 } catch (android.content.ActivityNotFoundException e) {
                     Log.e(LOG_TAG, "Couldn't launch image browser", e);
                 }
@@ -641,7 +642,9 @@ public class DeskClock extends Activity {
         musicButton.setOnClickListener(new View.OnClickListener() {
             public void onClick(View v) {
                 try {
-                    Intent musicAppQuery = getPackageManager().getLaunchIntentForPackage(MUSIC_PACKAGE_ID);
+                    Intent musicAppQuery = getPackageManager()
+                        .getLaunchIntentForPackage(MUSIC_PACKAGE_ID)
+                        .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                     if (musicAppQuery != null) {
                         startActivity(musicAppQuery);
                     }
@@ -656,6 +659,7 @@ public class DeskClock extends Activity {
             public void onClick(View v) {
                 startActivity(
                     new Intent(Intent.ACTION_MAIN)
+                        .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
                         .addCategory(Intent.CATEGORY_HOME));
             }
         });
@@ -680,7 +684,9 @@ public class DeskClock extends Activity {
             public void onClick(View v) {
                 if (!supportsWeather()) return;
 
-                Intent genieAppQuery = getPackageManager().getLaunchIntentForPackage(GENIE_PACKAGE_ID);
+                Intent genieAppQuery = getPackageManager()
+                    .getLaunchIntentForPackage(GENIE_PACKAGE_ID)
+                    .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                 if (genieAppQuery != null) {
                     startActivity(genieAppQuery);
                 }