List of usage examples for android.os SystemProperties getBoolean
@SystemApi public static boolean getBoolean(@NonNull String key, boolean def)
From source file:com.android.settings.sim.SimSelectNotification.java
@Override public void onReceive(Context context, Intent intent) { final TelephonyManager telephonyManager = (TelephonyManager) context .getSystemService(Context.TELEPHONY_SERVICE); final SubscriptionManager subscriptionManager = SubscriptionManager.from(context); final int numSlots = telephonyManager.getSimCount(); // Do not create notifications on single SIM devices or when provisioning i.e. Setup Wizard. // or User selection of fallback user preference is disabled. if (numSlots < 2 || !Utils.isDeviceProvisioned(context) || !SystemProperties.getBoolean("persist.radio.aosp_usr_pref_sel", false)) { Log.d(TAG, " no of slots " + numSlots + " provision = " + Utils.isDeviceProvisioned(context)); return;/* www . j a v a2s.c o m*/ } // Cancel any previous notifications cancelNotification(context); // If sim state is not ABSENT or LOADED then ignore String simStatus = intent.getStringExtra(IccCardConstants.INTENT_KEY_ICC_STATE); if (!(IccCardConstants.INTENT_VALUE_ICC_ABSENT.equals(simStatus) || IccCardConstants.INTENT_VALUE_ICC_LOADED.equals(simStatus))) { Log.d(TAG, "sim state is not Absent or Loaded"); return; } else { Log.d(TAG, "simstatus = " + simStatus); } int state; for (int i = 0; i < numSlots; i++) { state = telephonyManager.getSimState(i); if (!(state == TelephonyManager.SIM_STATE_ABSENT || state == TelephonyManager.SIM_STATE_READY || state == TelephonyManager.SIM_STATE_UNKNOWN)) { Log.d(TAG, "All sims not in valid state yet"); return; } } List<SubscriptionInfo> sil = subscriptionManager.getActiveSubscriptionInfoList(); if (sil == null || sil.size() < 1) { Log.d(TAG, "Subscription list is empty"); return; } // Clear defaults for any subscriptions which no longer exist subscriptionManager.clearDefaultsForInactiveSubIds(); boolean dataSelected = SubscriptionManager .isUsableSubIdValue(SubscriptionManager.getDefaultDataSubscriptionId()); boolean smsSelected = SubscriptionManager .isUsableSubIdValue(SubscriptionManager.getDefaultSmsSubscriptionId()); // If data and sms defaults are selected, dont show notification (Calls default is optional) if (dataSelected && smsSelected) { Log.d(TAG, "Data & SMS default sims are selected. No notification"); return; } // Create a notification to tell the user that some defaults are missing createNotification(context); if (sil.size() == 1) { // If there is only one subscription, ask if user wants to use if for everything Intent newIntent = new Intent(context, SimDialogActivity.class); newIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); newIntent.putExtra(SimDialogActivity.DIALOG_TYPE_KEY, SimDialogActivity.PREFERRED_PICK); newIntent.putExtra(SimDialogActivity.PREFERRED_SIM, sil.get(0).getSimSlotIndex()); context.startActivity(newIntent); } else if (!dataSelected) { // If there are mulitple, ensure they pick default data Intent newIntent = new Intent(context, SimDialogActivity.class); newIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); newIntent.putExtra(SimDialogActivity.DIALOG_TYPE_KEY, SimDialogActivity.DATA_PICK); context.startActivity(newIntent); } }
From source file:com.android.managedprovisioning.ProfileOwnerPreProvisioningActivity.java
/** * If the device is encrypted start the service which does the provisioning, otherwise ask for * user consent to encrypt the device.//from w ww .j av a 2s . c om */ private void checkEncryptedAndStartProvisioningService() { if (EncryptDeviceActivity.isDeviceEncrypted() || SystemProperties.getBoolean("persist.sys.no_req_encrypt", false)) { // Notify the user once more that the admin will have full control over the profile, // then start provisioning. UserConsentDialog.newInstance(UserConsentDialog.PROFILE_OWNER).show(getFragmentManager(), "UserConsentDialogFragment"); } else { Bundle resumeExtras = getIntent().getExtras(); resumeExtras.putString(EXTRA_RESUME_TARGET, TARGET_PROFILE_OWNER); Intent encryptIntent = new Intent(this, EncryptDeviceActivity.class).putExtra(EXTRA_RESUME, resumeExtras); startActivityForResult(encryptIntent, ENCRYPT_DEVICE_REQUEST_CODE); // Continue in onActivityResult or after reboot. } }
From source file:com.android.systemui.statusbar.phone.NotificationPanelView.java
protected void qucii_TouchMove_resetLayout(float newHeight) { if (mStatusBar.getBarState() == StatusBarState.KEYGUARD) { mChangedBottom = mNotificationContainerParent.getMeasuredHeight(); noBottom = mChangedBottom;//from w ww . jav a2s . c o m if (getBottom() != mChangedBottom) { setBottom(mChangedBottom); mNotificationContainerParent.setBottom(mChangedBottom); } } else { int mPanelHeight = Math.max(0, (int) newHeight); mPanelHeight = Math.min(mPanelHeight, getMaxPanelHeight()); if (SystemProperties.getBoolean("persist.sys.navg_bar_visible", false) && !isScreenLand()) { mPanelHeight = Math.min(mPanelHeight, getMaxPanelHeight() - mBarSize); } changeIndicatorVisable(mPanelHeight); setBottom(mPanelHeight); mChangedBottom = mPanelHeight; int arrowHeight = mArrowLayout.getMeasuredHeight(); noBottom = Math.max(-arrowHeight, mPanelHeight - arrowHeight); mNotificationContainerParent.setBottom(noBottom); mHeader.setBottom(Math.min(noBottom, mHeader.getMeasuredHeight())); mArrowLayout.layout(mArrowLayout.getLeft(), noBottom, mArrowLayout.getRight(), noBottom + arrowHeight); } }
From source file:com.android.systemui.statusbar.phone.NotificationPanelView.java
public void changeIndicatorVisable(int mPanelHeight) { boolean isMax = (mPanelHeight == getMaxPanelHeight()); if (SystemProperties.getBoolean("persist.sys.navg_bar_visible", false) && !isScreenLand()) { isMax = (mPanelHeight == getMaxPanelHeight() - mBarSize); }/* ww w . ja v a2s .c o m*/ if (isMax) { if (mArrow.getVisibility() == View.INVISIBLE) { return; } mIndicator.setVisibility(View.VISIBLE); mArrow.setVisibility(View.INVISIBLE); } else { if (mArrow.getVisibility() == View.VISIBLE) { return; } mIndicator.setVisibility(View.INVISIBLE); mArrow.setVisibility(View.VISIBLE); } }