Merge "Display Toast with linker warnings after Activity.onStart()" into nyc-dev
am: 1984d78330
* commit '1984d783304fe1ee915907d3a3c631f73d1243ff':
Display Toast with linker warnings after Activity.onStart()
This commit is contained in:
@@ -41,6 +41,7 @@ import android.content.Intent;
|
|||||||
import android.content.IntentSender;
|
import android.content.IntentSender;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
@@ -68,6 +69,7 @@ import android.os.Parcelable;
|
|||||||
import android.os.PersistableBundle;
|
import android.os.PersistableBundle;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.StrictMode;
|
import android.os.StrictMode;
|
||||||
|
import android.os.SystemProperties;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.text.Selection;
|
import android.text.Selection;
|
||||||
import android.text.SpannableStringBuilder;
|
import android.text.SpannableStringBuilder;
|
||||||
@@ -110,6 +112,7 @@ import android.view.WindowManager;
|
|||||||
import android.view.WindowManagerGlobal;
|
import android.view.WindowManagerGlobal;
|
||||||
import android.view.accessibility.AccessibilityEvent;
|
import android.view.accessibility.AccessibilityEvent;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.Toast;
|
||||||
import android.widget.Toolbar;
|
import android.widget.Toolbar;
|
||||||
|
|
||||||
import com.android.internal.app.IVoiceInteractor;
|
import com.android.internal.app.IVoiceInteractor;
|
||||||
@@ -832,6 +835,8 @@ public class Activity extends ContextThemeWrapper
|
|||||||
private boolean mHasCurrentPermissionsRequest;
|
private boolean mHasCurrentPermissionsRequest;
|
||||||
private boolean mEatKeyUpEvent;
|
private boolean mEatKeyUpEvent;
|
||||||
|
|
||||||
|
private static native String getDlWarning();
|
||||||
|
|
||||||
/** Return the intent that started this activity. */
|
/** Return the intent that started this activity. */
|
||||||
public Intent getIntent() {
|
public Intent getIntent() {
|
||||||
return mIntent;
|
return mIntent;
|
||||||
@@ -6621,6 +6626,31 @@ public class Activity extends ContextThemeWrapper
|
|||||||
}
|
}
|
||||||
mFragments.dispatchStart();
|
mFragments.dispatchStart();
|
||||||
mFragments.reportLoaderStart();
|
mFragments.reportLoaderStart();
|
||||||
|
|
||||||
|
// This property is set for all builds except final release
|
||||||
|
boolean isDlwarningEnabled = SystemProperties.getInt("ro.bionic.ld.warning", 0) == 1;
|
||||||
|
boolean isAppDebuggable =
|
||||||
|
(mApplication.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
|
||||||
|
|
||||||
|
if (isAppDebuggable || isDlwarningEnabled) {
|
||||||
|
String dlwarning = getDlWarning();
|
||||||
|
if (dlwarning != null) {
|
||||||
|
String appName = getString(mApplication.getApplicationInfo().labelRes);
|
||||||
|
String warning = "Detected problems with app native libraries\n" +
|
||||||
|
"(please consult log for detail):\n" + dlwarning;
|
||||||
|
if (isAppDebuggable) {
|
||||||
|
new AlertDialog.Builder(this).
|
||||||
|
setTitle(appName).
|
||||||
|
setMessage(warning).
|
||||||
|
setPositiveButton(android.R.string.ok, null).
|
||||||
|
setCancelable(false).
|
||||||
|
show();
|
||||||
|
} else {
|
||||||
|
Toast.makeText(this, appName + "\n" + warning, Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mActivityTransitionState.enterReady(this);
|
mActivityTransitionState.enterReady(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ LOCAL_SRC_FILES:= \
|
|||||||
com_android_internal_content_NativeLibraryHelper.cpp \
|
com_android_internal_content_NativeLibraryHelper.cpp \
|
||||||
com_google_android_gles_jni_EGLImpl.cpp \
|
com_google_android_gles_jni_EGLImpl.cpp \
|
||||||
com_google_android_gles_jni_GLImpl.cpp.arm \
|
com_google_android_gles_jni_GLImpl.cpp.arm \
|
||||||
|
android_app_Activity.cpp \
|
||||||
android_app_ApplicationLoaders.cpp \
|
android_app_ApplicationLoaders.cpp \
|
||||||
android_app_NativeActivity.cpp \
|
android_app_NativeActivity.cpp \
|
||||||
android_auditing_SecurityLog.cpp \
|
android_auditing_SecurityLog.cpp \
|
||||||
|
|||||||
@@ -178,6 +178,7 @@ extern int register_android_backup_FileBackupHelperBase(JNIEnv *env);
|
|||||||
extern int register_android_backup_BackupHelperDispatcher(JNIEnv *env);
|
extern int register_android_backup_BackupHelperDispatcher(JNIEnv *env);
|
||||||
extern int register_android_app_backup_FullBackup(JNIEnv *env);
|
extern int register_android_app_backup_FullBackup(JNIEnv *env);
|
||||||
extern int register_android_app_ApplicationLoaders(JNIEnv* env);
|
extern int register_android_app_ApplicationLoaders(JNIEnv* env);
|
||||||
|
extern int register_android_app_Activity(JNIEnv *env);
|
||||||
extern int register_android_app_ActivityThread(JNIEnv *env);
|
extern int register_android_app_ActivityThread(JNIEnv *env);
|
||||||
extern int register_android_app_NativeActivity(JNIEnv *env);
|
extern int register_android_app_NativeActivity(JNIEnv *env);
|
||||||
extern int register_android_media_RemoteDisplay(JNIEnv *env);
|
extern int register_android_media_RemoteDisplay(JNIEnv *env);
|
||||||
@@ -1373,6 +1374,7 @@ static const RegJNIRec gRegJNI[] = {
|
|||||||
REG_JNI(register_android_backup_BackupHelperDispatcher),
|
REG_JNI(register_android_backup_BackupHelperDispatcher),
|
||||||
REG_JNI(register_android_app_backup_FullBackup),
|
REG_JNI(register_android_app_backup_FullBackup),
|
||||||
REG_JNI(register_android_app_ApplicationLoaders),
|
REG_JNI(register_android_app_ApplicationLoaders),
|
||||||
|
REG_JNI(register_android_app_Activity),
|
||||||
REG_JNI(register_android_app_ActivityThread),
|
REG_JNI(register_android_app_ActivityThread),
|
||||||
REG_JNI(register_android_app_NativeActivity),
|
REG_JNI(register_android_app_NativeActivity),
|
||||||
REG_JNI(register_android_util_jar_StrictJarFile),
|
REG_JNI(register_android_util_jar_StrictJarFile),
|
||||||
|
|||||||
42
core/jni/android_app_Activity.cpp
Normal file
42
core/jni/android_app_Activity.cpp
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <poll.h>
|
||||||
|
#include <android/dlext.h>
|
||||||
|
|
||||||
|
#include "core_jni_helpers.h"
|
||||||
|
|
||||||
|
namespace android
|
||||||
|
{
|
||||||
|
|
||||||
|
static jstring getDlWarning_native(JNIEnv* env, jobject) {
|
||||||
|
const char* text = android_dlwarning();
|
||||||
|
return text == nullptr ? nullptr : env->NewStringUTF(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const JNINativeMethod g_methods[] = {
|
||||||
|
{ "getDlWarning",
|
||||||
|
"()Ljava/lang/String;",
|
||||||
|
reinterpret_cast<void*>(getDlWarning_native) },
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char* const kActivityPathName = "android/app/Activity";
|
||||||
|
|
||||||
|
int register_android_app_Activity(JNIEnv* env) {
|
||||||
|
return RegisterMethodsOrDie(env, kActivityPathName, g_methods, NELEM(g_methods));
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace android
|
||||||
Reference in New Issue
Block a user