本文整理汇总了Java中android.content.pm.ApplicationInfo.FLAG_DEBUGGABLE属性的典型用法代码示例。如果您正苦于以下问题:Java ApplicationInfo.FLAG_DEBUGGABLE属性的具体用法?Java ApplicationInfo.FLAG_DEBUGGABLE怎么用?Java ApplicationInfo.FLAG_DEBUGGABLE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.content.pm.ApplicationInfo
的用法示例。
在下文中一共展示了ApplicationInfo.FLAG_DEBUGGABLE属性的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CondomCore
CondomCore(final Context base, final CondomOptions options, final String tag) {
mBase = base;
DEBUG = (base.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
mExcludeBackgroundReceivers = options.mExcludeBackgroundReceivers;
mExcludeBackgroundServices = SDK_INT < O && options.mExcludeBackgroundServices;
mOutboundJudge = options.mOutboundJudge;
mDryRun = options.mDryRun;
mPackageManager = new Lazy<PackageManager>() { @Override protected PackageManager create() {
return new CondomPackageManager(CondomCore.this, base.getPackageManager(), tag);
}};
mContentResolver = new Lazy<ContentResolver>() { @Override protected ContentResolver create() {
return new CondomContentResolver(CondomCore.this, base, base.getContentResolver());
}};
final List<CondomKit> kits = options.mKits == null ? null : new ArrayList<>(options.mKits);
if (kits != null && ! kits.isEmpty()) {
mKitManager = new CondomKitManager();
for (final CondomKit kit : kits)
kit.onRegister(mKitManager);
} else mKitManager = null;
if (mDryRun) Log.w(tag, "Start dry-run mode, no outbound requests will be blocked actually, despite later stated in log.");
}
示例2: onReceivedSslError
/**
* Notify the host application that an SSL error occurred while loading a resource.
* The host application must call either handler.cancel() or handler.proceed().
* Note that the decision may be retained for use in response to future SSL errors.
* The default behavior is to cancel the load.
*
* @param view The WebView that is initiating the callback.
* @param handler An SslErrorHandler object that will handle the user's response.
* @param error The SSL error object.
*/
@TargetApi(8)
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
final String packageName = parentEngine.cordova.getActivity().getPackageName();
final PackageManager pm = parentEngine.cordova.getActivity().getPackageManager();
ApplicationInfo appInfo;
try {
appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA);
if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
// debug = true
handler.proceed();
return;
} else {
// debug = false
super.onReceivedSslError(view, handler, error);
}
} catch (NameNotFoundException e) {
// When it doubt, lock it out!
super.onReceivedSslError(view, handler, error);
}
}
示例3: build
public MobileEngageConfig build() {
boolean isDebuggable = (0 != (application.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE));
experimentalFeatures = experimentalFeatures == null ? new FlipperFeature[]{} : experimentalFeatures;
return new MobileEngageConfig(
application,
applicationCode,
applicationPassword,
statusListener,
isDebuggable,
idlingResourceEnabled,
oreoConfig,
defaultInAppMessageHandler,
experimentalFeatures
);
}
示例4: get
/**
* Returns a unique instance of the ViewServer. This method should only be
* called from the main thread of your application. The server will have
* the same lifetime as your process.
*
* If your application does not have the <code>android:debuggable</code>
* flag set in its manifest, the server returned by this method will
* be a dummy object that does not do anything. This allows you to use
* the same code in debug and release versions of your application.
*
* @param context A Context used to check whether the application is
* debuggable, this can be the application context
*/
public static ViewServer get(Context context) {
ApplicationInfo info = context.getApplicationInfo();
if (BUILD_TYPE_USER.equals(Build.TYPE) &&
(info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
if (sServer == null) {
sServer = new ViewServer(ViewServer.VIEW_SERVER_DEFAULT_PORT);
}
if (!sServer.isRunning()) {
try {
sServer.start();
} catch (IOException e) {
Log.d(LOG_TAG, "Error:", e);
}
}
} else {
sServer = new NoopViewServer();
}
return sServer;
}
示例5: isDeubgMode
public boolean isDeubgMode() {
try {
/**
* enable patch debug if in debug mode
*/
final ApplicationInfo app_info = KernalConstants.baseContext.getApplicationInfo();
boolean DEBUG = (app_info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
if (DEBUG) {
return true;
}
SharedPreferences sharedPreferences = KernalConstants.baseContext.getSharedPreferences("dynamic_test",Context.MODE_PRIVATE);
boolean dynamic_test_flag = sharedPreferences.getBoolean("dynamic_test_key",false);
if(dynamic_test_flag){
return true;
}
} catch (final Exception e) {
return false;
}
return false;
}
示例6: onUpdate
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
PackageManager packageManager = context.getPackageManager();
List<ApplicationInfo> installedApplications = packageManager.getInstalledApplications(0);
debugApps = new ArrayList<>();
for (ApplicationInfo applicationInfo : installedApplications) {
boolean isDebuggable = (0 != (applicationInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE));
if (isDebuggable) {
debugApps.add(applicationInfo);
}
}
for(int widgetId : appWidgetIds){
RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget);
setupRemoteViews(context, appWidgetManager, remoteViews, widgetId, 0);
}
}
示例7: get
/**
* Returns mContext unique instance of the ViewServer. This method should only be
* called from the main thread of your application. The server will have the
* same lifetime as your process.
* <p/>
* If your application does not have the <code>android:debuggable</code>
* flag set in its manifest, the server returned by this method will be mContext
* dummy object that does not do anything. This allows you to use the same
* code in DEBUG and release versions of your application.
*
* @param context A Context used to check whether the application is debuggable,
* this can be the application mainScriptContext
*/
public static ViewServer get(Context context) {
ApplicationInfo info = context.getApplicationInfo();
if (BUILD_TYPE_USER.equals(Build.TYPE) && (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
if (sServer == null) {
sServer = new ViewServer(ViewServer.VIEW_SERVER_DEFAULT_PORT);
}
if (!sServer.isRunning()) {
try {
sServer.start();
} catch (IOException e) {
MLog.d("LocalViewServer", "Error: " + e);
}
}
} else {
sServer = new NoopViewServer();
}
return sServer;
}
示例8: isDebug
public static boolean isDebug() {
if (sApplication == null) {
return false;
}
if (!isDebug) {
return false;
}
try {
ApplicationInfo info = sApplication.getApplicationInfo();
isDebug = (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
return isDebug;
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
示例9: isDebuggable
public static boolean isDebuggable(Context context) {
try {
return (context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
} catch (Exception e) {
}
return false;
}
示例10: performStart
final void performStart() {
mActivityTransitionState.setEnterActivityOptions(this, getActivityOptions());
mFragments.noteStateNotSaved();
mCalled = false;
mFragments.execPendingActions();
mInstrumentation.callActivityOnStart(this);
if (!mCalled) {
throw new SuperNotCalledException(
"Activity " + mComponent.toShortString() +
" did not call through to super.onStart()");
}
mFragments.dispatchStart();
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 = getApplicationInfo().loadLabel(getPackageManager())
.toString();
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);
}
示例11: isDebuggable
public static boolean isDebuggable(Context context) {
return (context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
}
示例12: debugMode
public static void debugMode(Context context) {
if (isDebug == null) {
isDebug = context.getApplicationInfo() != null &&
(context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
}
}
示例13: init
/**
* Init the framework
*
* @param application
* @return
* @throws Exception
*/
public void init(Application application,boolean reset) throws AssertionArrayException, Exception {
if(application==null){
throw new RuntimeException("application is null");
}
ApplicationInfo app_info = application.getApplicationInfo();
sAPKSource = app_info.sourceDir;
boolean DEBUG = (app_info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
RuntimeVariables.androidApplication = application;
RuntimeVariables.delegateResources = application.getResources();
DelegateResources.walkroundActionMenuTextColor(RuntimeVariables.delegateResources);
Framework.containerVersion = RuntimeVariables.sInstalledVersionName;
ClassLoader cl = Atlas.class.getClassLoader();
Framework.systemClassLoader = cl;
// defineAndVerify
String packageName = application.getPackageName();
//
DelegateClassLoader newClassLoader = new DelegateClassLoader(cl);
// init RuntimeVariables
RuntimeVariables.delegateClassLoader = newClassLoader;
AndroidHack.injectClassLoader(packageName, newClassLoader);
AndroidHack.injectInstrumentationHook(new InstrumentationHook(AndroidHack.getInstrumentation(), application.getBaseContext()));
// add listeners
bundleLifecycleHandler = new BundleLifecycleHandler();
Framework.syncBundleListeners.add(bundleLifecycleHandler);
frameworkLifecycleHandler = new FrameworkLifecycleHandler();
Framework.frameworkListeners.add(frameworkLifecycleHandler);
try {
ActivityManagerDelegate activityManagerProxy = new ActivityManagerDelegate();
Object gDefault = null;
if(Build.VERSION.SDK_INT>25 || (Build.VERSION.SDK_INT==25&&Build.VERSION.PREVIEW_SDK_INT>0)){
gDefault=AtlasHacks.ActivityManager_IActivityManagerSingleton.get(AtlasHacks.ActivityManager.getmClass());
}else{
gDefault=AtlasHacks.ActivityManagerNative_gDefault.get(AtlasHacks.ActivityManagerNative.getmClass());
}
AtlasHacks.Singleton_mInstance.hijack(gDefault, activityManagerProxy);
}catch(Throwable e){}
AndroidHack.hackH();
}
示例14: isDebug
static boolean isDebug(Context context) {
return (context.getApplicationContext().getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE) != 0;
}