List of usage examples for android.content.pm PackageManager FEATURE_TELEPHONY
String FEATURE_TELEPHONY
To view the source code for android.content.pm PackageManager FEATURE_TELEPHONY.
Click Source Link
From source file:info.zamojski.soft.towercollector.MainActivity.java
private void displayNotCompatibleDialog() { // check if displayed in this app run if (showNotCompatibleDialog) { // check if not disabled in preferences boolean showCompatibilityWarningEnabled = MyApplication.getPreferencesProvider() .getShowCompatibilityWarning(); if (showCompatibilityWarningEnabled) { TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); // check if device contains telephony hardware (some tablets doesn't report even if have) // NOTE: in the future this may need to be expanded when new specific features appear PackageManager packageManager = getPackageManager(); boolean noRadioDetected = !(packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY) && (packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY_GSM) || packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY_CDMA))); // show dialog if something is not supported if (noRadioDetected) { Log.d("displayNotCompatibleDialog(): Not compatible because of radio: %s, phone type: %s", noRadioDetected, telephonyManager.getPhoneType()); //use custom layout to show "don't show this again" checkbox AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this); LayoutInflater inflater = LayoutInflater.from(this); View dialogLayout = inflater.inflate(R.layout.dont_show_again_dialog, null); final CheckBox dontShowAgainCheckbox = (CheckBox) dialogLayout .findViewById(R.id.dont_show_again_dialog_checkbox); dialogBuilder.setView(dialogLayout); AlertDialog alertDialog = dialogBuilder.create(); alertDialog.setCanceledOnTouchOutside(true); alertDialog.setCancelable(true); alertDialog.setTitle(R.string.main_dialog_not_compatible_title); StringBuilder stringBuilder = new StringBuilder( getString(R.string.main_dialog_not_compatible_begin)); if (noRadioDetected) { stringBuilder.append(getString(R.string.main_dialog_no_compatible_mobile_radio_message)); }/*from w w w . j ava 2s . c o m*/ // text set this way to prevent checkbox from disappearing when text is too long TextView messageTextView = (TextView) dialogLayout .findViewById(R.id.dont_show_again_dialog_textview); messageTextView.setText(stringBuilder.toString()); alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, getString(R.string.dialog_ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { boolean dontShowAgainCheckboxChecked = dontShowAgainCheckbox.isChecked(); Log.d("displayNotCompatibleDialog(): Don't show again checkbox checked = %s", dontShowAgainCheckboxChecked); if (dontShowAgainCheckboxChecked) { MyApplication.getPreferencesProvider().setShowCompatibilityWarning(false); } } }); alertDialog.show(); } } showNotCompatibleDialog = false; } }
From source file:com.kyleszombathy.sms_scheduler.Home.java
private void displayErrorMessageIfDeviceCannotSendMessages() { PackageManager pm = this.getPackageManager(); if (!pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY) && !pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY_CDMA)) { Toast.makeText(this, R.string.Home_Notifications_CantSendMessages, Toast.LENGTH_SHORT).show(); }/*from ww w .j a v a 2s.c om*/ }
From source file:com.google.android.marvin.screenspeak.ScreenSpeakService.java
/** * Initializes the controllers, managers, and processors. This should only * be called once from {@link #onCreate}. *//*from w w w . ja v a 2s .c om*/ private void initializeInfrastructure() { // Initialize static instances that do not have dependencies. NodeSpeechRuleProcessor.initialize(this); final PackageManager packageManager = getPackageManager(); final boolean deviceIsPhone = packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY); //TODO we still need it keep true for TV until TouchExplore and Accessibility focus is not //unpaired //mSupportsTouchScreen = packageManager.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN); // Only initialize telephony and call state for phones. if (deviceIsPhone) { mCallStateMonitor = new CallStateMonitor(this); mAccessibilityEventProcessor.setCallStateMonitor(mCallStateMonitor); } mCursorController = new CursorControllerApp(this); addEventListener(mCursorController); mFeedbackController = new FeedbackControllerApp(this); mFullScreenReadController = new FullScreenReadControllerApp(mFeedbackController, mCursorController, this); addEventListener(mFullScreenReadController); mSpeechController = new SpeechController(this, mFeedbackController); mShakeDetector = new ShakeDetector(mFullScreenReadController, this); mMenuManager = new MenuManagerWrapper(); updateMenuManager(mSpeechController, mFeedbackController); // Sets mMenuManager mRingerModeAndScreenMonitor = new RingerModeAndScreenMonitor(mFeedbackController, mMenuManager, mShakeDetector, mSpeechController, this); mAccessibilityEventProcessor.setRingerModeAndScreenMonitor(mRingerModeAndScreenMonitor); mGestureController = new GestureControllerApp(this, mCursorController, mFeedbackController, mFullScreenReadController, mMenuManager); mSideTapManager = new SideTapManager(this, mGestureController); addEventListener(mSideTapManager); mFeedbackController.addHapticFeedbackListener(mSideTapManager); mTextCursorController = new TextCursorControllerApp(); addEventListener(mTextCursorController); // Add event processors. These will process incoming AccessibilityEvents // in the order they are added. ProcessorEventQueue processorEventQueue = new ProcessorEventQueue(mSpeechController, this); processorEventQueue.setTestingListener(mAccessibilityEventProcessor.getTestingListener()); mAccessibilityEventProcessor.setProcessorEventQueue(processorEventQueue); addEventListener(processorEventQueue); addEventListener(new ProcessorScrollPosition(mFullScreenReadController, mSpeechController, this)); addEventListener(new ProcessorAccessibilityHints(this, mSpeechController, mCursorController)); addEventListener(new ProcessorPhoneticLetters(this, mSpeechController)); mProcessorFollowFocus = new ProcessorFocusAndSingleTap(mCursorController, mFeedbackController, mSpeechController, this); addEventListener(mProcessorFollowFocus); if (mCursorController != null) { mCursorController.addScrollListener(mProcessorFollowFocus); } mVolumeMonitor = new VolumeMonitor(mSpeechController, this); mBatteryMonitor = new BatteryMonitor(this, mSpeechController, (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE)); if (Build.VERSION.SDK_INT >= PackageRemovalReceiver.MIN_API_LEVEL) { // TODO(KM): Move this into the custom label manager code mPackageReceiver = new PackageRemovalReceiver(); } if (Build.VERSION.SDK_INT >= ProcessorGestureVibrator.MIN_API_LEVEL) { addEventListener(new ProcessorGestureVibrator(mFeedbackController)); } addEventListener(new ProcessorWebContent(this)); DimScreenControllerApp dimScreenController = new DimScreenControllerApp(this); mDimScreenController = dimScreenController; if (Build.VERSION.SDK_INT >= ProcessorVolumeStream.MIN_API_LEVEL) { ProcessorVolumeStream processorVolumeStream = new ProcessorVolumeStream(mFeedbackController, mCursorController, mDimScreenController, this); addEventListener(processorVolumeStream); mKeyEventListeners.add(processorVolumeStream); } if (Build.VERSION.SDK_INT >= CustomLabelManager.MIN_API_LEVEL) { mLabelManager = new CustomLabelManager(this); } if (Build.VERSION.SDK_INT >= KeyComboManager.MIN_API_LEVEL) { mKeyComboManager = new KeyComboManager(this); mKeyComboManager.addListener(mKeyComboListener); // Search mode should receive key combos immediately after the ScreenSpeakService. if (Build.VERSION.SDK_INT >= KeyboardSearchManager.MIN_API_LEVEL) { mKeyboardSearchManager = new KeyboardSearchManager(this, mLabelManager); mKeyEventListeners.add(mKeyboardSearchManager); addEventListener(mKeyboardSearchManager); mKeyComboManager.addListener(mKeyboardSearchManager); } mKeyComboManager.addListener(mCursorController); mKeyEventListeners.add(mKeyComboManager); } addEventListener(mSavedNode); mOrientationMonitor = new OrientationMonitor(mSpeechController, this); mOrientationMonitor.addOnOrientationChangedListener(dimScreenController); mAnalytics = new ScreenSpeakAnalytics(this); }
From source file:com.google.android.marvin.mytalkback.TalkBackService.java
/** * Initializes the controllers, managers, and processors. This should only * be called once from {@link #onCreate}. *//* w w w .jav a 2 s . c o m*/ private void initializeInfrastructure() { // Initialize static instances that do not have dependencies. NodeSpeechRuleProcessor.initialize(this); ClassLoadingManager.getInstance().init(this); mAccessibilityManager = (AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE); mPowerManager = (PowerManager) getSystemService(POWER_SERVICE); // Initialize the feedback controller and load the default theme. mFeedbackController = MappedFeedbackController.initialize(this); final MappedThemeLoader themeLoader = mFeedbackController.getThemeLoader(); themeLoader.loadTheme(this, R.raw.feedbacktheme_default); mSpeechController = new SpeechController(this); if (Build.VERSION.SDK_INT >= CursorController.MIN_API_LEVEL) { mCursorController = new CursorController(this); mCursorController.setListener(mCursorControllerListener); mAccessibilityEventListeners.add(mCursorController); } if (Build.VERSION.SDK_INT >= FullScreenReadController.MIN_API_LEVEL) { mFullScreenReadController = new FullScreenReadController(this); mAccessibilityEventListeners.add(mFullScreenReadController); } if (Build.VERSION.SDK_INT >= ShakeDetector.MIN_API_LEVEL) { mShakeDetector = new ShakeDetector(this); } // Add event processors. These will process incoming AccessibilityEvents // in the order they are added. mProcessorEventQueue = new ProcessorEventQueue(this); mProcessorEventQueue.setTestingListener(mTestingListener); mAccessibilityEventListeners.add(mProcessorEventQueue); mAccessibilityEventListeners.add(new ProcessorScrollPosition(this)); if (Build.VERSION.SDK_INT >= ProcessorLongHover.MIN_API_LEVEL) { mAccessibilityEventListeners.add(new ProcessorLongHover(this)); } if (Build.VERSION.SDK_INT >= ProcessorFocusAndSingleTap.MIN_API_LEVEL) { mProcessorFollowFocus = new ProcessorFocusAndSingleTap(this); mAccessibilityEventListeners.add(mProcessorFollowFocus); } if (Build.VERSION.SDK_INT >= VolumeMonitor.MIN_API_LEVEL) { mVolumeMonitor = new VolumeMonitor(this); } if (Build.VERSION.SDK_INT >= ProcessorGestureVibrator.MIN_API_LEVEL) { mAccessibilityEventListeners.add(new ProcessorGestureVibrator()); } if (Build.VERSION.SDK_INT >= ProcessorWebContent.MIN_API_LEVEL) { mAccessibilityEventListeners.add(new ProcessorWebContent(this)); } if (Build.VERSION.SDK_INT >= ProcessorVolumeStream.MIN_API_LEVEL) { final ProcessorVolumeStream processorVolumeStream = new ProcessorVolumeStream(this); mAccessibilityEventListeners.add(processorVolumeStream); mKeyEventListeners.add(processorVolumeStream); } if (Build.VERSION.SDK_INT >= KeyComboManager.MIN_API_LEVEL) { final KeyComboManager keyComboManager = new KeyComboManager(); keyComboManager.setListener(mKeyComboListener); keyComboManager.loadDefaultCombos(); mKeyEventListeners.add(keyComboManager); } mOrientationMonitor = new OrientationMonitor(this); final PackageManager packageManager = getPackageManager(); final boolean deviceIsPhone = packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY); // Only initialize telephony and call state for phones. if (deviceIsPhone) { mCallStateMonitor = new CallStateMonitor(this); } final boolean deviceHasTouchscreen = packageManager.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN); if (deviceIsPhone || deviceHasTouchscreen) { // Although this receiver includes code responding to phone-specific // intents, it should also be registered for touch screen devices // without telephony. mRingerModeAndScreenMonitor = new RingerModeAndScreenMonitor(this); } if (Build.VERSION.SDK_INT >= TextToSpeechManager.MIN_API_LEVEL) { mTextToSpeechManager = new TextToSpeechManager(this); mTextToSpeechManager.addListener(mTtsDiscoveryListener); } // Set up the radial menu manager and TalkBack-specific client. final TalkBackRadialMenuClient radialMenuClient = new TalkBackRadialMenuClient(this); mRadialMenuManager = new RadialMenuManager(this); mRadialMenuManager.setClient(radialMenuClient); }
From source file:com.google.android.marvin.talkback.TalkBackService.java
/** * Initializes the controllers, managers, and processors. This should only * be called once from {@link #onCreate}. *//* w w w . j av a 2 s . c o m*/ private void initializeInfrastructure() { // Initialize static instances that do not have dependencies. NodeSpeechRuleProcessor.initialize(this); ClassLoadingManager.getInstance().init(this); mAccessibilityManager = (AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE); mPowerManager = (PowerManager) getSystemService(POWER_SERVICE); // Initialize the feedback controller and load the default theme. mFeedbackController = MappedFeedbackController.initialize(this); final MappedThemeLoader themeLoader = mFeedbackController.getThemeLoader(); themeLoader.loadTheme(this, R.raw.feedbacktheme_default); mSpeechController = new SpeechController(this); if (Build.VERSION.SDK_INT >= CursorController.MIN_API_LEVEL) { mCursorController = new CursorController(this); mCursorController.setListener(mCursorControllerListener); mAccessibilityEventListeners.add(mCursorController); } if (Build.VERSION.SDK_INT >= FullScreenReadController.MIN_API_LEVEL) { mFullScreenReadController = new FullScreenReadController(this); mAccessibilityEventListeners.add(mFullScreenReadController); } if (Build.VERSION.SDK_INT >= ShakeDetector.MIN_API_LEVEL) { mShakeDetector = new ShakeDetector(this); } // Add event processors. These will process incoming AccessibilityEvents // in the order they are added. mProcessorEventQueue = new ProcessorEventQueue(this); mProcessorEventQueue.setTestingListener(mTestingListener); mAccessibilityEventListeners.add(mProcessorEventQueue); mAccessibilityEventListeners.add(new ProcessorScrollPosition(this)); if (Build.VERSION.SDK_INT >= ProcessorLongHover.MIN_API_LEVEL) { mAccessibilityEventListeners.add(new ProcessorLongHover(this)); } if (Build.VERSION.SDK_INT >= ProcessorFocusAndSingleTap.MIN_API_LEVEL) { mProcessorFollowFocus = new ProcessorFocusAndSingleTap(this); mAccessibilityEventListeners.add(mProcessorFollowFocus); } if (Build.VERSION.SDK_INT >= VolumeMonitor.MIN_API_LEVEL) { mVolumeMonitor = new VolumeMonitor(this); } if (Build.VERSION.SDK_INT >= PackageRemovalReceiver.MIN_API_LEVEL) { mPackageReceiver = new PackageRemovalReceiver(); } if (Build.VERSION.SDK_INT >= ProcessorGestureVibrator.MIN_API_LEVEL) { mAccessibilityEventListeners.add(new ProcessorGestureVibrator()); } if (Build.VERSION.SDK_INT >= ProcessorWebContent.MIN_API_LEVEL) { mAccessibilityEventListeners.add(new ProcessorWebContent(this)); } if (Build.VERSION.SDK_INT >= ProcessorVolumeStream.MIN_API_LEVEL) { final ProcessorVolumeStream processorVolumeStream = new ProcessorVolumeStream(this); mAccessibilityEventListeners.add(processorVolumeStream); mKeyEventListeners.add(processorVolumeStream); } if (Build.VERSION.SDK_INT >= KeyComboManager.MIN_API_LEVEL) { final KeyComboManager keyComboManager = new KeyComboManager(); keyComboManager.setListener(mKeyComboListener); keyComboManager.loadDefaultCombos(); mKeyEventListeners.add(keyComboManager); } mOrientationMonitor = new OrientationMonitor(this); final PackageManager packageManager = getPackageManager(); final boolean deviceIsPhone = packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY); // Only initialize telephony and call state for phones. if (deviceIsPhone) { mCallStateMonitor = new CallStateMonitor(this); } final boolean deviceHasTouchscreen = packageManager.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN); if (deviceIsPhone || deviceHasTouchscreen) { // Although this receiver includes code responding to phone-specific // intents, it should also be registered for touch screen devices // without telephony. mRingerModeAndScreenMonitor = new RingerModeAndScreenMonitor(this); } if (Build.VERSION.SDK_INT >= TextToSpeechManager.MIN_API_LEVEL) { mTextToSpeechManager = new TextToSpeechManager(this); mTextToSpeechManager.addListener(mTtsDiscoveryListener); } // Set up the radial menu manager and TalkBack-specific client. final TalkBackRadialMenuClient radialMenuClient = new TalkBackRadialMenuClient(this); mRadialMenuManager = new RadialMenuManager(this); mRadialMenuManager.setClient(radialMenuClient); if (Build.VERSION.SDK_INT >= CustomLabelManager.MIN_API_LEVEL) { mLabelManager = new CustomLabelManager(this); mAccessibilityEventListeners.add(mLabelManager); } }
From source file:org.kontalk.ui.ComposeMessageFragment.java
private void updateUI() { Contact contact = (mConversation != null) ? mConversation.getContact() : null; boolean contactEnabled = contact != null && contact.getId() > 0; boolean threadEnabled = (threadId > 0); if (mCallMenu != null) { Context context = getActivity(); // FIXME what about VoIP? if (context != null && !context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) { mCallMenu.setVisible(false).setEnabled(false); } else {//from w w w . j a v a 2 s .co m mCallMenu.setVisible(true).setEnabled(true); mCallMenu.setEnabled(contactEnabled); } mViewContactMenu.setEnabled(contactEnabled); mDeleteThreadMenu.setEnabled(threadEnabled); } if (mBlockMenu != null) { Context context = getActivity(); if (context != null && Authenticator.isSelfJID(context, mUserJID)) { mBlockMenu.setVisible(false).setEnabled(false); mUnblockMenu.setVisible(false).setEnabled(false); } else if (contact != null) { // block/unblock boolean blocked = contact.isBlocked(); if (blocked) // show warning if blocked showWarning(getText(R.string.warning_user_blocked), null, WarningType.WARNING); mBlockMenu.setVisible(!blocked).setEnabled(!blocked); mUnblockMenu.setVisible(blocked).setEnabled(blocked); } else { mBlockMenu.setVisible(true).setEnabled(true); mUnblockMenu.setVisible(true).setEnabled(true); } } }