Loading cmds/app_process/app_main.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -304,9 +304,9 @@ int main(int argc, char* const argv[]) } if (zygote) { runtime.start("com.android.internal.os.ZygoteInit", args); runtime.start("com.android.internal.os.ZygoteInit", args, zygote); } else if (className) { runtime.start("com.android.internal.os.RuntimeInit", args); runtime.start("com.android.internal.os.RuntimeInit", args, zygote); } else { fprintf(stderr, "Error: no class name or --zygote supplied.\n"); app_usage(); Loading core/jni/AndroidRuntime.cpp +10 −6 Original line number Diff line number Diff line Loading @@ -526,7 +526,7 @@ bool AndroidRuntime::parseCompilerRuntimeOption(const char* property, * * Returns 0 on success. */ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv) int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv, bool zygote) { int result = -1; JavaVMInitArgs initArgs; Loading Loading @@ -731,9 +731,13 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv) } } /* enable debugging; set suspend=y to pause during VM init */ /* use android ADB transport */ /* * Enable debugging only for apps forked from zygote. * Set suspend=y to pause during VM init and use android ADB transport. */ if (zygote) { addOption("-agentlib:jdwp=transport=dt_android_adb,suspend=n,server=y"); } parseRuntimeOption("dalvik.vm.lockprof.threshold", lockProfThresholdBuf, Loading Loading @@ -946,7 +950,7 @@ jstring AndroidRuntime::NewStringLatin1(JNIEnv* env, const char* bytes) { * Passes the main function two arguments, the class name and the specified * options string. */ void AndroidRuntime::start(const char* className, const Vector<String8>& options) void AndroidRuntime::start(const char* className, const Vector<String8>& options, bool zygote) { ALOGD(">>>>>> START %s uid %d <<<<<<\n", className != NULL ? className : "(unknown)", getuid()); Loading Loading @@ -982,7 +986,7 @@ void AndroidRuntime::start(const char* className, const Vector<String8>& options JniInvocation jni_invocation; jni_invocation.Init(NULL); JNIEnv* env; if (startVm(&mJavaVM, &env) != 0) { if (startVm(&mJavaVM, &env, zygote) != 0) { return; } onVmCreated(env); Loading include/android_runtime/AndroidRuntime.h +2 −2 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ public: */ static jclass findClass(JNIEnv* env, const char* className); void start(const char *classname, const Vector<String8>& options); void start(const char *classname, const Vector<String8>& options, bool zygote); void exit(int code); Loading Loading @@ -131,7 +131,7 @@ private: const char* runtimeArg, const char* quotingArg); void parseExtraOpts(char* extraOptsBuf, const char* quotingArg); int startVm(JavaVM** pJavaVM, JNIEnv** pEnv); int startVm(JavaVM** pJavaVM, JNIEnv** pEnv, bool zygote); Vector<JavaVMOption> mOptions; bool mExitWithoutCleanup; Loading packages/SystemUI/src/com/android/systemui/media/MediaProjectionPermissionActivity.java +54 −2 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.content.DialogInterface; import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.graphics.Typeface; import android.media.projection.MediaProjectionManager; import android.media.projection.IMediaProjectionManager; import android.media.projection.IMediaProjection; Loading @@ -31,9 +32,17 @@ import android.os.Bundle; import android.os.IBinder; import android.os.RemoteException; import android.os.ServiceManager; import android.text.BidiFormatter; import android.text.Spannable; import android.text.SpannableString; import android.text.TextPaint; import android.text.TextUtils; import android.text.style.StyleSpan; import android.util.Log; import android.util.TypedValue; import android.view.LayoutInflater; import android.view.WindowManager; import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.TextView; Loading @@ -47,6 +56,8 @@ public class MediaProjectionPermissionActivity extends Activity implements DialogInterface.OnClickListener, CheckBox.OnCheckedChangeListener, DialogInterface.OnCancelListener { private static final String TAG = "MediaProjectionPermissionActivity"; private static final float MAX_APP_NAME_SIZE_PX = 500f; private static final String ELLIPSIS = "\u2026"; private boolean mPermanentGrant; private String mPackageName; Loading Loading @@ -92,11 +103,49 @@ public class MediaProjectionPermissionActivity extends Activity return; } String appName = aInfo.loadLabel(packageManager).toString(); TextPaint paint = new TextPaint(); paint.setTextSize(42); String label = aInfo.loadLabel(packageManager).toString(); // If the label contains new line characters it may push the security // message below the fold of the dialog. Labels shouldn't have new line // characters anyways, so just truncate the message the first time one // is seen. final int labelLength = label.length(); int offset = 0; while (offset < labelLength) { final int codePoint = label.codePointAt(offset); final int type = Character.getType(codePoint); if (type == Character.LINE_SEPARATOR || type == Character.CONTROL || type == Character.PARAGRAPH_SEPARATOR) { label = label.substring(0, offset) + ELLIPSIS; break; } offset += Character.charCount(codePoint); } if (label.isEmpty()) { label = mPackageName; } String unsanitizedAppName = TextUtils.ellipsize(label, paint, MAX_APP_NAME_SIZE_PX, TextUtils.TruncateAt.END).toString(); String appName = BidiFormatter.getInstance().unicodeWrap(unsanitizedAppName); String actionText = getString(R.string.media_projection_dialog_text, appName); SpannableString message = new SpannableString(actionText); int appNameIndex = actionText.indexOf(appName); if (appNameIndex >= 0) { message.setSpan(new StyleSpan(Typeface.BOLD), appNameIndex, appNameIndex + appName.length(), 0); } mDialog = new AlertDialog.Builder(this) .setIcon(aInfo.loadIcon(packageManager)) .setMessage(getString(R.string.media_projection_dialog_text, appName)) .setMessage(message) .setPositiveButton(R.string.media_projection_action_text, this) .setNegativeButton(android.R.string.cancel, this) .setView(R.layout.remember_permission_checkbox) Loading @@ -105,6 +154,9 @@ public class MediaProjectionPermissionActivity extends Activity mDialog.create(); Button btn = mDialog.getButton(DialogInterface.BUTTON_POSITIVE); btn.getRootView().setFilterTouchesWhenObscured(true); ((CheckBox) mDialog.findViewById(R.id.remember)).setOnCheckedChangeListener(this); mDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); Loading services/core/java/com/android/server/power/PowerManagerService.java +5 −3 Original line number Diff line number Diff line Loading @@ -2579,7 +2579,7 @@ public final class PowerManagerService extends SystemService /** * Low-level function to reboot the device. On success, this * function doesn't return. If more than 20 seconds passes from * the time a reboot is requested (120 seconds for reboot to * the time a reboot is requested (900 seconds for reboot to * recovery), this method returns. * * @param reason code to pass to the kernel (e.g. "recovery"), or null. Loading @@ -2597,9 +2597,11 @@ public final class PowerManagerService extends SystemService // // This preparation can take more than 20 seconds if // there's a very large update package, so lengthen the // timeout. We have seen 750MB packages take 3-4 minutes // timeout. We have seen 750MB packages take 3-4 minutes. // Bump up the limit again to 900s for really large packages. // Bug: 23629892. SystemProperties.set("ctl.start", "pre-recovery"); duration = 300 * 1000L; duration = 900 * 1000L; } else { SystemProperties.set("sys.powerctl", "reboot," + reason); duration = 20 * 1000L; Loading Loading
cmds/app_process/app_main.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -304,9 +304,9 @@ int main(int argc, char* const argv[]) } if (zygote) { runtime.start("com.android.internal.os.ZygoteInit", args); runtime.start("com.android.internal.os.ZygoteInit", args, zygote); } else if (className) { runtime.start("com.android.internal.os.RuntimeInit", args); runtime.start("com.android.internal.os.RuntimeInit", args, zygote); } else { fprintf(stderr, "Error: no class name or --zygote supplied.\n"); app_usage(); Loading
core/jni/AndroidRuntime.cpp +10 −6 Original line number Diff line number Diff line Loading @@ -526,7 +526,7 @@ bool AndroidRuntime::parseCompilerRuntimeOption(const char* property, * * Returns 0 on success. */ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv) int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv, bool zygote) { int result = -1; JavaVMInitArgs initArgs; Loading Loading @@ -731,9 +731,13 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv) } } /* enable debugging; set suspend=y to pause during VM init */ /* use android ADB transport */ /* * Enable debugging only for apps forked from zygote. * Set suspend=y to pause during VM init and use android ADB transport. */ if (zygote) { addOption("-agentlib:jdwp=transport=dt_android_adb,suspend=n,server=y"); } parseRuntimeOption("dalvik.vm.lockprof.threshold", lockProfThresholdBuf, Loading Loading @@ -946,7 +950,7 @@ jstring AndroidRuntime::NewStringLatin1(JNIEnv* env, const char* bytes) { * Passes the main function two arguments, the class name and the specified * options string. */ void AndroidRuntime::start(const char* className, const Vector<String8>& options) void AndroidRuntime::start(const char* className, const Vector<String8>& options, bool zygote) { ALOGD(">>>>>> START %s uid %d <<<<<<\n", className != NULL ? className : "(unknown)", getuid()); Loading Loading @@ -982,7 +986,7 @@ void AndroidRuntime::start(const char* className, const Vector<String8>& options JniInvocation jni_invocation; jni_invocation.Init(NULL); JNIEnv* env; if (startVm(&mJavaVM, &env) != 0) { if (startVm(&mJavaVM, &env, zygote) != 0) { return; } onVmCreated(env); Loading
include/android_runtime/AndroidRuntime.h +2 −2 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ public: */ static jclass findClass(JNIEnv* env, const char* className); void start(const char *classname, const Vector<String8>& options); void start(const char *classname, const Vector<String8>& options, bool zygote); void exit(int code); Loading Loading @@ -131,7 +131,7 @@ private: const char* runtimeArg, const char* quotingArg); void parseExtraOpts(char* extraOptsBuf, const char* quotingArg); int startVm(JavaVM** pJavaVM, JNIEnv** pEnv); int startVm(JavaVM** pJavaVM, JNIEnv** pEnv, bool zygote); Vector<JavaVMOption> mOptions; bool mExitWithoutCleanup; Loading
packages/SystemUI/src/com/android/systemui/media/MediaProjectionPermissionActivity.java +54 −2 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.content.DialogInterface; import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.graphics.Typeface; import android.media.projection.MediaProjectionManager; import android.media.projection.IMediaProjectionManager; import android.media.projection.IMediaProjection; Loading @@ -31,9 +32,17 @@ import android.os.Bundle; import android.os.IBinder; import android.os.RemoteException; import android.os.ServiceManager; import android.text.BidiFormatter; import android.text.Spannable; import android.text.SpannableString; import android.text.TextPaint; import android.text.TextUtils; import android.text.style.StyleSpan; import android.util.Log; import android.util.TypedValue; import android.view.LayoutInflater; import android.view.WindowManager; import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.TextView; Loading @@ -47,6 +56,8 @@ public class MediaProjectionPermissionActivity extends Activity implements DialogInterface.OnClickListener, CheckBox.OnCheckedChangeListener, DialogInterface.OnCancelListener { private static final String TAG = "MediaProjectionPermissionActivity"; private static final float MAX_APP_NAME_SIZE_PX = 500f; private static final String ELLIPSIS = "\u2026"; private boolean mPermanentGrant; private String mPackageName; Loading Loading @@ -92,11 +103,49 @@ public class MediaProjectionPermissionActivity extends Activity return; } String appName = aInfo.loadLabel(packageManager).toString(); TextPaint paint = new TextPaint(); paint.setTextSize(42); String label = aInfo.loadLabel(packageManager).toString(); // If the label contains new line characters it may push the security // message below the fold of the dialog. Labels shouldn't have new line // characters anyways, so just truncate the message the first time one // is seen. final int labelLength = label.length(); int offset = 0; while (offset < labelLength) { final int codePoint = label.codePointAt(offset); final int type = Character.getType(codePoint); if (type == Character.LINE_SEPARATOR || type == Character.CONTROL || type == Character.PARAGRAPH_SEPARATOR) { label = label.substring(0, offset) + ELLIPSIS; break; } offset += Character.charCount(codePoint); } if (label.isEmpty()) { label = mPackageName; } String unsanitizedAppName = TextUtils.ellipsize(label, paint, MAX_APP_NAME_SIZE_PX, TextUtils.TruncateAt.END).toString(); String appName = BidiFormatter.getInstance().unicodeWrap(unsanitizedAppName); String actionText = getString(R.string.media_projection_dialog_text, appName); SpannableString message = new SpannableString(actionText); int appNameIndex = actionText.indexOf(appName); if (appNameIndex >= 0) { message.setSpan(new StyleSpan(Typeface.BOLD), appNameIndex, appNameIndex + appName.length(), 0); } mDialog = new AlertDialog.Builder(this) .setIcon(aInfo.loadIcon(packageManager)) .setMessage(getString(R.string.media_projection_dialog_text, appName)) .setMessage(message) .setPositiveButton(R.string.media_projection_action_text, this) .setNegativeButton(android.R.string.cancel, this) .setView(R.layout.remember_permission_checkbox) Loading @@ -105,6 +154,9 @@ public class MediaProjectionPermissionActivity extends Activity mDialog.create(); Button btn = mDialog.getButton(DialogInterface.BUTTON_POSITIVE); btn.getRootView().setFilterTouchesWhenObscured(true); ((CheckBox) mDialog.findViewById(R.id.remember)).setOnCheckedChangeListener(this); mDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); Loading
services/core/java/com/android/server/power/PowerManagerService.java +5 −3 Original line number Diff line number Diff line Loading @@ -2579,7 +2579,7 @@ public final class PowerManagerService extends SystemService /** * Low-level function to reboot the device. On success, this * function doesn't return. If more than 20 seconds passes from * the time a reboot is requested (120 seconds for reboot to * the time a reboot is requested (900 seconds for reboot to * recovery), this method returns. * * @param reason code to pass to the kernel (e.g. "recovery"), or null. Loading @@ -2597,9 +2597,11 @@ public final class PowerManagerService extends SystemService // // This preparation can take more than 20 seconds if // there's a very large update package, so lengthen the // timeout. We have seen 750MB packages take 3-4 minutes // timeout. We have seen 750MB packages take 3-4 minutes. // Bump up the limit again to 900s for really large packages. // Bug: 23629892. SystemProperties.set("ctl.start", "pre-recovery"); duration = 300 * 1000L; duration = 900 * 1000L; } else { SystemProperties.set("sys.powerctl", "reboot," + reason); duration = 20 * 1000L; Loading