当前位置: 首页>>代码示例>>Java>>正文


Java ApplicationInfo.FLAG_DEBUGGABLE属性代码示例

本文整理汇总了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.");
}
 
开发者ID:oasisfeng,项目名称:condom,代码行数:24,代码来源:CondomCore.java

示例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);
    }
}
 
开发者ID:Andy-Ta,项目名称:COB,代码行数:33,代码来源:SystemWebViewClient.java

示例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
    );
}
 
开发者ID:emartech,项目名称:android-mobile-engage-sdk,代码行数:17,代码来源:MobileEngageConfig.java

示例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;
}
 
开发者ID:alibaba,项目名称:Virtualview-Android,代码行数:34,代码来源:ViewServer.java

示例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;
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:20,代码来源:KernalBundle.java

示例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);
    }
}
 
开发者ID:EmmettWilson,项目名称:AppTerminator,代码行数:18,代码来源:TerminatorWidgetProvider.java

示例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;
}
 
开发者ID:victordiaz,项目名称:phonk,代码行数:33,代码来源:ViewServer.java

示例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;
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:16,代码来源:UWXApplication.java

示例9: isDebuggable

public static boolean isDebuggable(Context context) {
    try {
        return (context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
    } catch (Exception e) {

    }
    return false;
}
 
开发者ID:yufeilong92,项目名称:update-master,代码行数:8,代码来源:UpdateUtil.java

示例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);
}
 
开发者ID:JessYanCoding,项目名称:ProgressManager,代码行数:41,代码来源:a.java

示例11: isDebuggable

public static boolean isDebuggable(Context context) {
    return (context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
}
 
开发者ID:rafaeltoledo,项目名称:android-security,代码行数:3,代码来源:EnvironmentChecker.java

示例12: debugMode

public static void debugMode(Context context) {
    if (isDebug == null) {
        isDebug = context.getApplicationInfo() != null &&
                (context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
    }
}
 
开发者ID:ThinkKeep,项目名称:EvilsLive,代码行数:6,代码来源:AppUtils.java

示例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();
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:48,代码来源:Atlas.java

示例14: isDebug

static boolean isDebug(Context context) {
    return (context.getApplicationContext().getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE) != 0;
}
 
开发者ID:bravobit,项目名称:FFmpeg-Android,代码行数:3,代码来源:Util.java


注:本文中的android.content.pm.ApplicationInfo.FLAG_DEBUGGABLE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。