Search in sources :

Example 76 with PersistableBundle

use of android.os.PersistableBundle in project android_packages_apps_Settings by omnirom.

the class RestrictedDashboardFragment method ensurePin.

private void ensurePin() {
    if (!mChallengeSucceeded && !mChallengeRequested && mRestrictionsManager.hasRestrictionsProvider()) {
        Intent intent = mRestrictionsManager.createLocalApprovalIntent();
        if (intent != null) {
            mChallengeRequested = true;
            mChallengeSucceeded = false;
            PersistableBundle request = new PersistableBundle();
            request.putString(RestrictionsManager.REQUEST_KEY_MESSAGE, getResources().getString(R.string.restr_pin_enter_admin_pin));
            intent.putExtra(RestrictionsManager.EXTRA_REQUEST_BUNDLE, request);
            startActivityForResult(intent, REQUEST_PIN_CHALLENGE);
        }
    }
}
Also used : PersistableBundle(android.os.PersistableBundle) Intent(android.content.Intent)

Example 77 with PersistableBundle

use of android.os.PersistableBundle in project android_packages_apps_Settings by omnirom.

the class SimStatus method updatePreference.

private void updatePreference() {
    if (mPhone.getPhoneType() != TelephonyManager.PHONE_TYPE_CDMA) {
        mShowLatestAreaInfo = Resources.getSystem().getBoolean(com.android.internal.R.bool.config_showAreaUpdateInfoSettings);
    }
    PersistableBundle carrierConfig = mCarrierConfigManager.getConfigForSubId(mSir.getSubscriptionId());
    mShowICCID = carrierConfig.getBoolean(CarrierConfigManager.KEY_SHOW_ICCID_IN_SIM_STATUS_BOOL);
    // If formattedNumber is null or empty, it'll display as "Unknown".
    setSummaryText(KEY_PHONE_NUMBER, DeviceInfoUtils.getFormattedPhoneNumber(getContext(), mSir));
    setSummaryText(KEY_IMEI, mPhone.getImei());
    setSummaryText(KEY_IMEI_SV, mPhone.getDeviceSvn());
    if (!mShowICCID) {
        removePreferenceFromScreen(KEY_ICCID);
    } else {
        // Get ICCID, which is SIM serial number
        String iccid = mTelephonyManager.getSimSerialNumber(mSir.getSubscriptionId());
        setSummaryText(KEY_ICCID, iccid);
    }
    if (!mShowLatestAreaInfo) {
        removePreferenceFromScreen(KEY_LATEST_AREA_INFO);
    }
}
Also used : PersistableBundle(android.os.PersistableBundle)

Example 78 with PersistableBundle

use of android.os.PersistableBundle in project android_packages_apps_Settings by crdroidandroid.

the class RestrictedDashboardFragment method ensurePin.

private void ensurePin() {
    if (!mChallengeSucceeded && !mChallengeRequested && mRestrictionsManager.hasRestrictionsProvider()) {
        Intent intent = mRestrictionsManager.createLocalApprovalIntent();
        if (intent != null) {
            mChallengeRequested = true;
            mChallengeSucceeded = false;
            PersistableBundle request = new PersistableBundle();
            request.putString(RestrictionsManager.REQUEST_KEY_MESSAGE, getResources().getString(R.string.restr_pin_enter_admin_pin));
            intent.putExtra(RestrictionsManager.EXTRA_REQUEST_BUNDLE, request);
            startActivityForResult(intent, REQUEST_PIN_CHALLENGE);
        }
    }
}
Also used : PersistableBundle(android.os.PersistableBundle) Intent(android.content.Intent)

Example 79 with PersistableBundle

use of android.os.PersistableBundle in project android_packages_apps_Settings by crdroidandroid.

the class ConditionManager method saveToXml.

private void saveToXml() {
    if (DEBUG)
        Log.d(TAG, "Writing to " + mXmlFile.toString());
    try {
        XmlSerializer serializer = Xml.newSerializer();
        FileWriter writer = new FileWriter(mXmlFile);
        serializer.setOutput(writer);
        serializer.startDocument("UTF-8", true);
        serializer.startTag("", TAG_CONDITIONS);
        final int N = mConditions.size();
        for (int i = 0; i < N; i++) {
            PersistableBundle bundle = new PersistableBundle();
            if (mConditions.get(i).saveState(bundle)) {
                serializer.startTag("", TAG_CONDITION);
                final String clz = mConditions.get(i).getClass().getSimpleName();
                serializer.attribute("", ATTR_CLASS, clz);
                bundle.saveToXml(serializer);
                serializer.endTag("", TAG_CONDITION);
            }
        }
        serializer.endTag("", TAG_CONDITIONS);
        serializer.flush();
        writer.close();
    } catch (XmlPullParserException | IOException e) {
        Log.w(TAG, "Problem writing " + FILE_NAME, e);
    }
}
Also used : PersistableBundle(android.os.PersistableBundle) FileWriter(java.io.FileWriter) XmlPullParserException(org.xmlpull.v1.XmlPullParserException) IOException(java.io.IOException) XmlSerializer(org.xmlpull.v1.XmlSerializer)

Example 80 with PersistableBundle

use of android.os.PersistableBundle in project android_packages_apps_Settings by crdroidandroid.

the class WifiCallingSettings method getCarrierActivityIntent.

/*
     * Get the Intent to launch carrier emergency address management activity.
     * Return null when no activity found.
     */
private static Intent getCarrierActivityIntent(Context context) {
    // Retrive component name from carrirt config
    CarrierConfigManager configManager = context.getSystemService(CarrierConfigManager.class);
    if (configManager == null)
        return null;
    PersistableBundle bundle = configManager.getConfig();
    if (bundle == null)
        return null;
    String carrierApp = bundle.getString(CarrierConfigManager.KEY_WFC_EMERGENCY_ADDRESS_CARRIER_APP_STRING);
    if (TextUtils.isEmpty(carrierApp))
        return null;
    ComponentName componentName = ComponentName.unflattenFromString(carrierApp);
    if (componentName == null)
        return null;
    // Build and return intent
    Intent intent = new Intent();
    intent.setComponent(componentName);
    return intent;
}
Also used : CarrierConfigManager(android.telephony.CarrierConfigManager) PersistableBundle(android.os.PersistableBundle) ComponentName(android.content.ComponentName) Intent(android.content.Intent)

Aggregations

PersistableBundle (android.os.PersistableBundle)321 CarrierConfigManager (android.telephony.CarrierConfigManager)87 ComponentName (android.content.ComponentName)67 Intent (android.content.Intent)63 ShortcutInfo (android.content.pm.ShortcutInfo)48 Test (org.junit.Test)35 Bundle (android.os.Bundle)28 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)25 IOException (java.io.IOException)21 Icon (android.graphics.drawable.Icon)17 JobInfo (android.app.job.JobInfo)15 IntentFilter (android.content.IntentFilter)15 Account (android.accounts.Account)14 Activity (android.app.Activity)12 TelephonyManager (android.telephony.TelephonyManager)12 SmallTest (android.test.suitebuilder.annotation.SmallTest)12 XmlPullParser (org.xmlpull.v1.XmlPullParser)12 Before (org.junit.Before)11 PendingIntent (android.app.PendingIntent)9 PackageManager (android.content.pm.PackageManager)9