Example usage for android.content.pm PackageManager FEATURE_TOUCHSCREEN

List of usage examples for android.content.pm PackageManager FEATURE_TOUCHSCREEN

Introduction

In this page you can find the example usage for android.content.pm PackageManager FEATURE_TOUCHSCREEN.

Prototype

String FEATURE_TOUCHSCREEN

To view the source code for android.content.pm PackageManager FEATURE_TOUCHSCREEN.

Click Source Link

Document

Feature for #getSystemAvailableFeatures and #hasSystemFeature : The device's display has a touch screen.

Usage

From source file:github.daneren2005.dsub.activity.SubsonicActivity.java

@Override
protected void onCreate(Bundle bundle) {
    UiModeManager uiModeManager = (UiModeManager) getSystemService(UI_MODE_SERVICE);
    if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION) {
        // tv = true;
    }//w w w.j  a va2s  .  c  o m
    PackageManager pm = getPackageManager();
    if (!pm.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN)) {
        touchscreen = false;
    }

    setUncaughtExceptionHandler();
    applyTheme();
    applyFullscreen();
    super.onCreate(bundle);
    startService(new Intent(this, DownloadService.class));
    setVolumeControlStream(AudioManager.STREAM_MUSIC);

    if (getIntent().hasExtra(Constants.FRAGMENT_POSITION)) {
        lastSelectedPosition = getIntent().getIntExtra(Constants.FRAGMENT_POSITION, 0);
    }

    if (preferencesListener == null) {
        preferencesListener = new SharedPreferences.OnSharedPreferenceChangeListener() {
            @Override
            public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
                // When changing drawer settings change visibility
                switch (key) {
                case Constants.PREFERENCES_KEY_PODCASTS_ENABLED:
                    setDrawerItemVisible(R.id.drawer_podcasts, false);
                    break;
                case Constants.PREFERENCES_KEY_BOOKMARKS_ENABLED:
                    setDrawerItemVisible(R.id.drawer_bookmarks, false);
                    break;
                case Constants.PREFERENCES_KEY_SHARED_ENABLED:
                    setDrawerItemVisible(R.id.drawer_shares, false);
                    break;
                case Constants.PREFERENCES_KEY_CHAT_ENABLED:
                    setDrawerItemVisible(R.id.drawer_chat, false);
                    break;
                case Constants.PREFERENCES_KEY_ADMIN_ENABLED:
                    setDrawerItemVisible(R.id.drawer_admin, false);
                    break;
                }
            }
        };
        Util.getPreferences(this).registerOnSharedPreferenceChangeListener(preferencesListener);
    }
}

From source file:github.popeen.dsub.activity.SubsonicActivity.java

@Override
protected void onCreate(Bundle bundle) {

    sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
    sensorManager.registerListener(this, sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),
            SensorManager.SENSOR_DELAY_NORMAL);

    UiModeManager uiModeManager = (UiModeManager) getSystemService(UI_MODE_SERVICE);
    if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION) {
        // tv = true;
    }/*from  ww  w. jav  a 2 s  . co m*/
    PackageManager pm = getPackageManager();
    if (!pm.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN)) {
        touchscreen = false;
    }

    setUncaughtExceptionHandler();
    applyTheme();
    applyFullscreen();
    super.onCreate(bundle);
    startService(new Intent(this, DownloadService.class));
    setVolumeControlStream(AudioManager.STREAM_MUSIC);

    if (getIntent().hasExtra(Constants.FRAGMENT_POSITION)) {
        lastSelectedPosition = getIntent().getIntExtra(Constants.FRAGMENT_POSITION, 0);
    }

    if (preferencesListener == null) {
        preferencesListener = new SharedPreferences.OnSharedPreferenceChangeListener() {
            @Override
            public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
                // When changing drawer settings change visibility
                switch (key) {
                case Constants.PREFERENCES_KEY_PODCASTS_ENABLED:
                    setDrawerItemVisible(R.id.drawer_podcasts, false);
                    break;
                case Constants.PREFERENCES_KEY_BOOKMARKS_ENABLED:
                    setDrawerItemVisible(R.id.drawer_bookmarks, false);
                    break;
                case Constants.PREFERENCES_KEY_INTERNET_RADIO_ENABLED:
                    setDrawerItemVisible(R.id.drawer_internet_radio_stations, false);
                    break;
                case Constants.PREFERENCES_KEY_SHARED_ENABLED:
                    setDrawerItemVisible(R.id.drawer_shares, false);
                    break;
                case Constants.PREFERENCES_KEY_CHAT_ENABLED:
                    setDrawerItemVisible(R.id.drawer_chat, false);
                    break;
                case Constants.PREFERENCES_KEY_ADMIN_ENABLED:
                    setDrawerItemVisible(R.id.drawer_admin, false);
                    break;
                }
            }
        };
        Util.getPreferences(this).registerOnSharedPreferenceChangeListener(preferencesListener);
    }

    if (ContextCompat.checkSelfPermission(this,
            permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
        ActivityCompat.requestPermissions(this, new String[] { permission.WRITE_EXTERNAL_STORAGE },
                PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE);
    }
}

From source file:Main.java

/**
 * A single feature that can be requested by an application.
 * This corresponds to information collected from the AndroidManifest.xml's tag.
 * @param feature "FeatureInfo"/*from w  w w.j a va2s  .c om*/
 */
@SuppressWarnings("deprecation")
public static String getFeature(String feature) {
    if (TextUtils.isEmpty(feature)) {
        return UNKNOWN;
    }

    switch (feature) {
    case PackageManager.FEATURE_APP_WIDGETS://android.software.app_widgets
        return "FEATURE_APP_WIDGETS";
    case PackageManager.FEATURE_AUDIO_LOW_LATENCY://android.hardware.audio.low_latency
        return "FEATURE_AUDIO_LOW_LATENCY";
    case PackageManager.FEATURE_AUDIO_OUTPUT://android.hardware.audio.output
        return "FEATURE_AUDIO_OUTPUT";
    case PackageManager.FEATURE_AUDIO_PRO://android.hardware.audio.pro
        return "FEATURE_AUDIO_PRO";//API 23
    case PackageManager.FEATURE_AUTOMOTIVE://android.hardware.type.automotive
        return "FEATURE_AUTOMOTIVE";//API 23
    case PackageManager.FEATURE_BACKUP://android.software.backup
        return "FEATURE_BACKUP";
    case PackageManager.FEATURE_BLUETOOTH://android.hardware.bluetooth
        return "FEATURE_BLUETOOTH";
    case PackageManager.FEATURE_BLUETOOTH_LE://android.hardware.bluetooth_le
        return "FEATURE_BLUETOOTH_LE";
    case PackageManager.FEATURE_CAMERA://android.hardware.camera
        return "FEATURE_CAMERA";
    case PackageManager.FEATURE_CAMERA_ANY://android.hardware.camera.any
        return "FEATURE_CAMERA_ANY";
    case PackageManager.FEATURE_CAMERA_AUTOFOCUS://android.hardware.camera.autofocus
        return "FEATURE_CAMERA_AUTOFOCUS";
    case PackageManager.FEATURE_CAMERA_CAPABILITY_MANUAL_POST_PROCESSING://android.hardware.camera.capability.manual_post_processing
        return "FEATURE_CAMERA_CAPABILITY_MANUAL_POST_PROCESSING";
    case PackageManager.FEATURE_CAMERA_CAPABILITY_MANUAL_SENSOR://android.hardware.camera.capability.manual_sensor
        return "FEATURE_CAMERA_CAPABILITY_MANUAL_SENSOR";
    case PackageManager.FEATURE_CAMERA_CAPABILITY_RAW://android.hardware.camera.capability.raw
        return "FEATURE_CAMERA_CAPABILITY_RAW";
    case PackageManager.FEATURE_CAMERA_EXTERNAL://android.hardware.camera.external
        return "FEATURE_CAMERA_EXTERNAL";
    case PackageManager.FEATURE_CAMERA_FLASH://android.hardware.camera.flash
        return "FEATURE_CAMERA_FLASH";
    case PackageManager.FEATURE_CAMERA_FRONT://android.hardware.camera.front
        return "FEATURE_CAMERA_FRONT";
    case PackageManager.FEATURE_CAMERA_LEVEL_FULL://android.hardware.camera.level.full
        return "FEATURE_CAMERA_LEVEL_FULL";
    case PackageManager.FEATURE_CONNECTION_SERVICE://android.software.connectionservice
        return "FEATURE_CONNECTION_SERVICE";
    case PackageManager.FEATURE_CONSUMER_IR://android.hardware.consumerir
        return "FEATURE_CONSUMER_IR";
    case PackageManager.FEATURE_DEVICE_ADMIN://android.software.device_admin
        return "FEATURE_DEVICE_ADMIN";
    case PackageManager.FEATURE_FAKETOUCH://android.hardware.faketouch
        return "FEATURE_FAKETOUCH";
    case PackageManager.FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT://android.hardware.faketouch.multitouch.distinct
        return "FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT";
    case PackageManager.FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND://android.hardware.faketouch.multitouch.jazzhand
        return "FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND";
    case PackageManager.FEATURE_FINGERPRINT://android.hardware.fingerprint
        return "FEATURE_FINGERPRINT";//API 23
    case PackageManager.FEATURE_GAMEPAD://android.hardware.gamepad
        return "FEATURE_GAMEPAD";
    case PackageManager.FEATURE_HIFI_SENSORS://android.hardware.sensor.hifi_sensors
        return "FEATURE_HIFI_SENSORS";//API 23
    case PackageManager.FEATURE_HOME_SCREEN://android.software.home_screen
        return "FEATURE_HOME_SCREEN";
    case PackageManager.FEATURE_INPUT_METHODS://android.software.input_methods
        return "FEATURE_INPUT_METHODS";
    case PackageManager.FEATURE_LEANBACK://android.software.leanback
        return "FEATURE_LEANBACK";
    case PackageManager.FEATURE_LIVE_TV://android.software.live_tv
        return "FEATURE_LIVE_TV";
    case PackageManager.FEATURE_LIVE_WALLPAPER://android.software.live_wallpaper
        return "FEATURE_LIVE_WALLPAPER";
    case PackageManager.FEATURE_LOCATION://android.hardware.location
        return "FEATURE_LOCATION";
    case PackageManager.FEATURE_LOCATION_GPS://android.hardware.location.gps
        return "FEATURE_LOCATION_GPS";
    case PackageManager.FEATURE_LOCATION_NETWORK://android.hardware.location.network
        return "FEATURE_LOCATION_NETWORK";
    case PackageManager.FEATURE_MANAGED_USERS://android.software.managed_users
        return "FEATURE_MANAGED_USERS";
    case PackageManager.FEATURE_MICROPHONE://android.hardware.microphone
        return "FEATURE_MICROPHONE";
    case PackageManager.FEATURE_MIDI://android.software.midi
        return "FEATURE_MIDI";//API 23
    case PackageManager.FEATURE_NFC://android.hardware.nfc
        return "FEATURE_NFC";
    case PackageManager.FEATURE_NFC_HOST_CARD_EMULATION://android.hardware.nfc.hce
        return "FEATURE_NFC_HOST_CARD_EMULATION";
    case PackageManager.FEATURE_OPENGLES_EXTENSION_PACK://android.hardware.opengles.aep
        return "FEATURE_OPENGLES_EXTENSION_PACK";
    case PackageManager.FEATURE_PRINTING://android.software.print
        return "FEATURE_PRINTING";
    case PackageManager.FEATURE_SCREEN_LANDSCAPE://android.hardware.screen.landscape
        return "FEATURE_SCREEN_LANDSCAPE";
    case PackageManager.FEATURE_SCREEN_PORTRAIT://android.hardware.screen.portrait
        return "FEATURE_SCREEN_PORTRAIT";
    case PackageManager.FEATURE_SECURELY_REMOVES_USERS://android.software.securely_removes_users
        return "FEATURE_SECURELY_REMOVES_USERS";
    case PackageManager.FEATURE_SENSOR_ACCELEROMETER://android.hardware.sensor.accelerometer
        return "FEATURE_SENSOR_ACCELEROMETER";
    case PackageManager.FEATURE_SENSOR_AMBIENT_TEMPERATURE://android.hardware.sensor.ambient_temperature
        return "FEATURE_SENSOR_AMBIENT_TEMPERATURE";
    case PackageManager.FEATURE_SENSOR_BAROMETER://android.hardware.sensor.barometer
        return "FEATURE_SENSOR_BAROMETER";
    case PackageManager.FEATURE_SENSOR_COMPASS://android.hardware.sensor.compass
        return "FEATURE_SENSOR_COMPASS";
    case PackageManager.FEATURE_SENSOR_GYROSCOPE://android.hardware.sensor.gyroscope
        return "FEATURE_SENSOR_GYROSCOPE";
    case PackageManager.FEATURE_SENSOR_HEART_RATE://android.hardware.sensor.heartrate
        return "FEATURE_SENSOR_HEART_RATE";
    case PackageManager.FEATURE_SENSOR_HEART_RATE_ECG://android.hardware.sensor.heartrate.ecg
        return "FEATURE_SENSOR_HEART_RATE_ECG";
    case PackageManager.FEATURE_SENSOR_LIGHT://android.hardware.sensor.light
        return "FEATURE_SENSOR_LIGHT";
    case PackageManager.FEATURE_SENSOR_PROXIMITY://android.hardware.sensor.proximity
        return "FEATURE_SENSOR_PROXIMITY";
    case PackageManager.FEATURE_SENSOR_RELATIVE_HUMIDITY://android.hardware.sensor.relative_humidity
        return "FEATURE_SENSOR_RELATIVE_HUMIDITY";
    case PackageManager.FEATURE_SENSOR_STEP_COUNTER://android.hardware.sensor.stepcounter
        return "FEATURE_SENSOR_STEP_COUNTER";
    case PackageManager.FEATURE_SENSOR_STEP_DETECTOR://android.hardware.sensor.stepdetector
        return "FEATURE_SENSOR_STEP_DETECTOR";
    case PackageManager.FEATURE_SIP://android.software.sip
        return "FEATURE_SIP";
    case PackageManager.FEATURE_SIP_VOIP://android.software.sip.voip
        return "FEATURE_SIP_VOIP";
    case PackageManager.FEATURE_TELEPHONY://android.hardware.telephony
        return "FEATURE_TELEPHONY";
    case PackageManager.FEATURE_TELEPHONY_CDMA://android.hardware.telephony.cdma
        return "FEATURE_TELEPHONY_CDMA";
    case PackageManager.FEATURE_TELEPHONY_GSM://android.hardware.telephony.gsm
        return "FEATURE_TELEPHONY_GSM";
    case PackageManager.FEATURE_TELEVISION://android.hardware.type.television
        return "FEATURE_TELEVISION";
    case PackageManager.FEATURE_TOUCHSCREEN://android.hardware.touchscreen
        return "FEATURE_TOUCHSCREEN";
    case PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH://android.hardware.touchscreen.multitouch
        return "FEATURE_TOUCHSCREEN_MULTITOUCH";
    case PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT://android.hardware.touchscreen.multitouch.distinct
        return "FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT";
    case PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND://android.hardware.touchscreen.multitouch.jazzhand
        return "FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND";
    case PackageManager.FEATURE_USB_ACCESSORY://android.hardware.usb.accessory
        return "FEATURE_USB_ACCESSORY";
    case PackageManager.FEATURE_USB_HOST://android.hardware.usb.host
        return "FEATURE_USB_HOST";
    case PackageManager.FEATURE_VERIFIED_BOOT://android.software.verified_boot
        return "FEATURE_VERIFIED_BOOT";
    case PackageManager.FEATURE_WATCH://android.hardware.type.watch
        return "FEATURE_WATCH";
    case PackageManager.FEATURE_WEBVIEW://android.software.webview
        return "FEATURE_WEBVIEW";
    case PackageManager.FEATURE_WIFI://android.hardware.wifi
        return "FEATURE_WIFI";
    case PackageManager.FEATURE_WIFI_DIRECT://android.hardware.wifi.direct
        return "FEATURE_WIFI_DIRECT";
    default:
        return UNKNOWN;
    }
}

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 .  ja  v  a 2s. 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}.
 *///from w w  w  . ja  v  a 2 s.  co 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:com.vuze.android.remote.AndroidUtils.java

public static boolean hasTouchScreen() {
    if (hasTouchScreen == null) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) {
            hasTouchScreen = VuzeRemoteApp.getContext().getPackageManager()
                    .hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN);
        } else {//from  ww  w  . j  av a2s . com
            hasTouchScreen = true;
        }
    }
    return hasTouchScreen;
}

From source file:com.codename1.impl.android.AndroidImplementation.java

@Override
public boolean isTouchDevice() {
    return getContext().getPackageManager().hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN);
}