Loading core/res/res/layout/launch_warning.xml 0 → 100644 +65 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- /* Copyright 2010, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="6dp" android:paddingBottom="6dp" android:scaleType="fitXY" android:gravity="fill_horizontal" android:src="@android:drawable/divider_horizontal_dark" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="10dip" android:orientation="horizontal"> <ImageView android:id="@+id/replace_app_icon" android:layout_width="@android:dimen/app_icon_size" android:layout_height="@android:dimen/app_icon_size" android:scaleType="fitCenter" /> <TextView android:id="@+id/replace_message" style="?android:attr/textAppearanceMedium" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="5dip" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="10dip" android:orientation="horizontal"> <ImageView android:id="@+id/original_app_icon" android:layout_width="@android:dimen/app_icon_size" android:layout_height="@android:dimen/app_icon_size" android:scaleType="fitCenter" /> <TextView android:id="@+id/original_message" style="?android:attr/textAppearanceMedium" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="5dip" /> </LinearLayout> </LinearLayout> core/res/res/values/strings.xml +6 −0 Original line number Diff line number Diff line Loading @@ -1921,6 +1921,12 @@ <string name="report">Report</string> <!-- Button allowing the user to choose to wait for an application that is not responding to become responsive again. --> <string name="wait">Wait</string> <!-- [CHAR LIMIT=25] Title of the alert when application launches on top of another. --> <string name="launch_warning_title">Application redirected</string> <!-- [CHAR LIMIT=50] Title of the alert when application launches on top of another. --> <string name="launch_warning_replace"><xliff:g id="app_name">%1$s</xliff:g> is now running.</string> <!-- [CHAR LIMIT=50] Title of the alert when application launches on top of another. --> <string name="launch_warning_original"><xliff:g id="app_name">%1$s</xliff:g> was originally launched.</string> <!-- Text of the alert that is displayed when an application has violated StrictMode. --> <string name="smv_application">The application <xliff:g id="application">%1$s</xliff:g> Loading core/res/res/values/themes.xml +7 −0 Original line number Diff line number Diff line Loading @@ -522,4 +522,11 @@ <item name="android:textColor">@android:color/secondary_text_nofocus</item> </style> <!-- Default theme for window that looks like a toast. --> <style name="Theme.Toast" parent="@android:style/Theme.Dialog"> <item name="android:windowBackground">@android:drawable/toast_frame</item> <item name="android:windowAnimationStyle">@android:style/Animation.Toast</item> <item name="android:backgroundDimEnabled">false</item> </style> </resources> services/java/com/android/server/am/ActivityManagerService.java +25 −0 Original line number Diff line number Diff line Loading @@ -752,6 +752,7 @@ public final class ActivityManagerService extends ActivityManagerNative boolean mWaitingUpdate = false; boolean mDidUpdate = false; boolean mOnBattery = false; boolean mLaunchWarningShown = false; Context mContext; Loading Loading @@ -2902,6 +2903,30 @@ public final class ActivityManagerService extends ActivityManagerNative } } final void showLaunchWarningLocked(final ActivityRecord cur, final ActivityRecord next) { if (!mLaunchWarningShown) { mLaunchWarningShown = true; mHandler.post(new Runnable() { @Override public void run() { synchronized (ActivityManagerService.this) { final Dialog d = new LaunchWarningWindow(mContext, cur, next); d.show(); mHandler.postDelayed(new Runnable() { @Override public void run() { synchronized (ActivityManagerService.this) { d.dismiss(); mLaunchWarningShown = false; } } }, 4000); } } }); } } final void decPersistentCountLocked(ProcessRecord app) { app.persistentActivities--; if (app.persistentActivities > 0) { Loading services/java/com/android/server/am/ActivityRecord.java +17 −8 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.os.SystemClock; import android.util.EventLog; import android.util.Log; import android.util.Slog; import android.util.TimeUtils; import android.view.IApplicationToken; import java.io.PrintWriter; Loading Loading @@ -68,7 +69,8 @@ class ActivityRecord extends IApplicationToken.Stub { int icon; // resource identifier of activity's icon. int theme; // resource identifier of activity's theme. TaskRecord task; // the task this is in. long startTime; // when we starting launching this activity long launchTime; // when we starting launching this activity long startTime; // last time this activity was started long cpuTimeAtResume; // the cpu time of host process at the time of resuming activity Configuration configuration; // configuration activity was last running in ActivityRecord resultTo; // who started this entry, so will get our reply Loading Loading @@ -165,6 +167,11 @@ class ActivityRecord extends IApplicationToken.Stub { pw.print(" frozenBeforeDestroy="); pw.print(frozenBeforeDestroy); pw.print(" thumbnailNeeded="); pw.print(thumbnailNeeded); pw.print(" idle="); pw.println(idle); if (launchTime != 0 || startTime != 0) { pw.print(prefix); pw.print("launchTime="); TimeUtils.formatDuration(launchTime, pw); pw.print(" startTime="); TimeUtils.formatDuration(startTime, pw); pw.println(""); } if (waitingVisible || nowVisible) { pw.print(prefix); pw.print("waitingVisible="); pw.print(waitingVisible); pw.print(" nowVisible="); pw.println(nowVisible); Loading Loading @@ -417,9 +424,9 @@ class ActivityRecord extends IApplicationToken.Stub { public void windowsVisible() { synchronized(service) { if (startTime != 0) { if (launchTime != 0) { final long curTime = SystemClock.uptimeMillis(); final long thisTime = curTime - startTime; final long thisTime = curTime - launchTime; final long totalTime = stack.mInitialStartTime != 0 ? (curTime - stack.mInitialStartTime) : thisTime; if (ActivityManagerService.SHOW_ACTIVITY_START_TIME) { Loading @@ -428,22 +435,24 @@ class ActivityRecord extends IApplicationToken.Stub { thisTime, totalTime); StringBuilder sb = service.mStringBuilder; sb.setLength(0); sb.append("Displayed activity "); sb.append("Displayed "); sb.append(shortComponentName); sb.append(": "); sb.append(thisTime); sb.append(" ms (total "); TimeUtils.formatDuration(thisTime, sb); sb.append(" (total "); TimeUtils.formatDuration(totalTime, sb); sb.append(totalTime); sb.append(" ms)"); sb.append(")"); Log.i(ActivityManagerService.TAG, sb.toString()); } stack.reportActivityLaunchedLocked(false, this, thisTime, totalTime); if (totalTime > 0) { service.mUsageStatsService.noteLaunchTime(realActivity, (int)totalTime); } startTime = 0; launchTime = 0; stack.mInitialStartTime = 0; } startTime = 0; stack.reportActivityVisibleLocked(this); if (ActivityManagerService.DEBUG_SWITCH) Log.v( ActivityManagerService.TAG, "windowsVisible(): " + this); Loading Loading
core/res/res/layout/launch_warning.xml 0 → 100644 +65 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- /* Copyright 2010, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="6dp" android:paddingBottom="6dp" android:scaleType="fitXY" android:gravity="fill_horizontal" android:src="@android:drawable/divider_horizontal_dark" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="10dip" android:orientation="horizontal"> <ImageView android:id="@+id/replace_app_icon" android:layout_width="@android:dimen/app_icon_size" android:layout_height="@android:dimen/app_icon_size" android:scaleType="fitCenter" /> <TextView android:id="@+id/replace_message" style="?android:attr/textAppearanceMedium" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="5dip" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="10dip" android:orientation="horizontal"> <ImageView android:id="@+id/original_app_icon" android:layout_width="@android:dimen/app_icon_size" android:layout_height="@android:dimen/app_icon_size" android:scaleType="fitCenter" /> <TextView android:id="@+id/original_message" style="?android:attr/textAppearanceMedium" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="5dip" /> </LinearLayout> </LinearLayout>
core/res/res/values/strings.xml +6 −0 Original line number Diff line number Diff line Loading @@ -1921,6 +1921,12 @@ <string name="report">Report</string> <!-- Button allowing the user to choose to wait for an application that is not responding to become responsive again. --> <string name="wait">Wait</string> <!-- [CHAR LIMIT=25] Title of the alert when application launches on top of another. --> <string name="launch_warning_title">Application redirected</string> <!-- [CHAR LIMIT=50] Title of the alert when application launches on top of another. --> <string name="launch_warning_replace"><xliff:g id="app_name">%1$s</xliff:g> is now running.</string> <!-- [CHAR LIMIT=50] Title of the alert when application launches on top of another. --> <string name="launch_warning_original"><xliff:g id="app_name">%1$s</xliff:g> was originally launched.</string> <!-- Text of the alert that is displayed when an application has violated StrictMode. --> <string name="smv_application">The application <xliff:g id="application">%1$s</xliff:g> Loading
core/res/res/values/themes.xml +7 −0 Original line number Diff line number Diff line Loading @@ -522,4 +522,11 @@ <item name="android:textColor">@android:color/secondary_text_nofocus</item> </style> <!-- Default theme for window that looks like a toast. --> <style name="Theme.Toast" parent="@android:style/Theme.Dialog"> <item name="android:windowBackground">@android:drawable/toast_frame</item> <item name="android:windowAnimationStyle">@android:style/Animation.Toast</item> <item name="android:backgroundDimEnabled">false</item> </style> </resources>
services/java/com/android/server/am/ActivityManagerService.java +25 −0 Original line number Diff line number Diff line Loading @@ -752,6 +752,7 @@ public final class ActivityManagerService extends ActivityManagerNative boolean mWaitingUpdate = false; boolean mDidUpdate = false; boolean mOnBattery = false; boolean mLaunchWarningShown = false; Context mContext; Loading Loading @@ -2902,6 +2903,30 @@ public final class ActivityManagerService extends ActivityManagerNative } } final void showLaunchWarningLocked(final ActivityRecord cur, final ActivityRecord next) { if (!mLaunchWarningShown) { mLaunchWarningShown = true; mHandler.post(new Runnable() { @Override public void run() { synchronized (ActivityManagerService.this) { final Dialog d = new LaunchWarningWindow(mContext, cur, next); d.show(); mHandler.postDelayed(new Runnable() { @Override public void run() { synchronized (ActivityManagerService.this) { d.dismiss(); mLaunchWarningShown = false; } } }, 4000); } } }); } } final void decPersistentCountLocked(ProcessRecord app) { app.persistentActivities--; if (app.persistentActivities > 0) { Loading
services/java/com/android/server/am/ActivityRecord.java +17 −8 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.os.SystemClock; import android.util.EventLog; import android.util.Log; import android.util.Slog; import android.util.TimeUtils; import android.view.IApplicationToken; import java.io.PrintWriter; Loading Loading @@ -68,7 +69,8 @@ class ActivityRecord extends IApplicationToken.Stub { int icon; // resource identifier of activity's icon. int theme; // resource identifier of activity's theme. TaskRecord task; // the task this is in. long startTime; // when we starting launching this activity long launchTime; // when we starting launching this activity long startTime; // last time this activity was started long cpuTimeAtResume; // the cpu time of host process at the time of resuming activity Configuration configuration; // configuration activity was last running in ActivityRecord resultTo; // who started this entry, so will get our reply Loading Loading @@ -165,6 +167,11 @@ class ActivityRecord extends IApplicationToken.Stub { pw.print(" frozenBeforeDestroy="); pw.print(frozenBeforeDestroy); pw.print(" thumbnailNeeded="); pw.print(thumbnailNeeded); pw.print(" idle="); pw.println(idle); if (launchTime != 0 || startTime != 0) { pw.print(prefix); pw.print("launchTime="); TimeUtils.formatDuration(launchTime, pw); pw.print(" startTime="); TimeUtils.formatDuration(startTime, pw); pw.println(""); } if (waitingVisible || nowVisible) { pw.print(prefix); pw.print("waitingVisible="); pw.print(waitingVisible); pw.print(" nowVisible="); pw.println(nowVisible); Loading Loading @@ -417,9 +424,9 @@ class ActivityRecord extends IApplicationToken.Stub { public void windowsVisible() { synchronized(service) { if (startTime != 0) { if (launchTime != 0) { final long curTime = SystemClock.uptimeMillis(); final long thisTime = curTime - startTime; final long thisTime = curTime - launchTime; final long totalTime = stack.mInitialStartTime != 0 ? (curTime - stack.mInitialStartTime) : thisTime; if (ActivityManagerService.SHOW_ACTIVITY_START_TIME) { Loading @@ -428,22 +435,24 @@ class ActivityRecord extends IApplicationToken.Stub { thisTime, totalTime); StringBuilder sb = service.mStringBuilder; sb.setLength(0); sb.append("Displayed activity "); sb.append("Displayed "); sb.append(shortComponentName); sb.append(": "); sb.append(thisTime); sb.append(" ms (total "); TimeUtils.formatDuration(thisTime, sb); sb.append(" (total "); TimeUtils.formatDuration(totalTime, sb); sb.append(totalTime); sb.append(" ms)"); sb.append(")"); Log.i(ActivityManagerService.TAG, sb.toString()); } stack.reportActivityLaunchedLocked(false, this, thisTime, totalTime); if (totalTime > 0) { service.mUsageStatsService.noteLaunchTime(realActivity, (int)totalTime); } startTime = 0; launchTime = 0; stack.mInitialStartTime = 0; } startTime = 0; stack.reportActivityVisibleLocked(this); if (ActivityManagerService.DEBUG_SWITCH) Log.v( ActivityManagerService.TAG, "windowsVisible(): " + this); Loading