Example usage for android.content Context CONTEXT_RESTRICTED

List of usage examples for android.content Context CONTEXT_RESTRICTED

Introduction

In this page you can find the example usage for android.content Context CONTEXT_RESTRICTED.

Prototype

int CONTEXT_RESTRICTED

To view the source code for android.content Context CONTEXT_RESTRICTED.

Click Source Link

Document

Flag for use with #createPackageContext : a restricted context may disable specific features.

Usage

From source file:Main.java

public static boolean isGXModSystemUI(Context context) {
    Context mContext = null;/*from www.jav a 2s.c  o  m*/
    int id = 0;
    try {
        mContext = context.createPackageContext("com.android.systemui", Context.CONTEXT_RESTRICTED);
        id = mContext.getResources().getIdentifier("custom_SystemUI0_3", "bool", mContext.getPackageName());
    } catch (NameNotFoundException e) {
        return false;
    }
    return id > 0;
}

From source file:com.achep.acdisplay.notifications.NotificationUtils.java

public static Context createContext(Context context, StatusBarNotification n) {
    try {/* ww  w.ja  v a  2  s .co m*/
        return context.createPackageContext(n.getPackageName(), Context.CONTEXT_RESTRICTED);
    } catch (PackageManager.NameNotFoundException e) {
        Log.w(TAG, "Failed to create notification\'s context");
        return null;
    }
}