Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8caeb56b authored by Tom Giordano's avatar Tom Giordano Committed by Tanguy Pruvot
Browse files

LegacyUSB: Add support for legacy USB implementations

Rebased for ICS 4.0.3

Change-Id: I029d8eeca4de6d92499856feab2761a8bfa9a526
parent 3354539f
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -745,4 +745,11 @@
    <!-- Base "touch slop" value used by ViewConfiguration as a
         movement threshold where scrolling should begin. -->
    <dimen name="config_viewConfigurationTouchSlop">8dp</dimen>


    <!-- CM CHANGES START HERE -->

    <!-- Use legacy USB device manager. -->
    <bool name="config_usesLegacyUsbDeviceManager">false</bool>

</resources>
+643 −0

File added.

Preview size limit exceeded, changes collapsed.

+8 −0
Original line number Diff line number Diff line
@@ -130,6 +130,14 @@ public class UsbDeviceManager {
        }
    };

    // Dummy constructor to use when extending class
    public UsbDeviceManager() {
        mContext = null;
        mContentResolver = null;
        mSettingsManager = null;
        mHasUsbAccessory = false;
    }

    public UsbDeviceManager(Context context, UsbSettingsManager settingsManager) {
        mContext = context;
        mContentResolver = context.getContentResolver();
+3 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.server.usb;
import android.app.PendingIntent;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.hardware.usb.IUsbManager;
import android.hardware.usb.UsbAccessory;
import android.hardware.usb.UsbDevice;
@@ -53,6 +54,8 @@ public class UsbService extends IUsbManager.Stub {
        if (new File("/sys/class/android_usb").exists()) {
            mDeviceManager = new UsbDeviceManager(context, mSettingsManager);
        }
        else if(Resources.getSystem().getBoolean(com.android.internal.R.bool.config_usesLegacyUsbDeviceManager))
            mDeviceManager = new LegacyUsbDeviceManager(context, mSettingsManager);
    }

    public void systemReady() {