summaryrefslogtreecommitdiffstats
path: root/core/java/android/hardware
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2011-06-22 15:19:33 -0400
committerMike Lockwood <lockwood@android.com>2011-06-22 15:19:33 -0400
commitf59717ddb5ef324ee3fdb12b83e7d1b709793d28 (patch)
tree17d0e9e37910a1a4ef46b244115c396754f8b187 /core/java/android/hardware
parent7730ad569d2c8dd6387be40685f5e99462a59352 (diff)
downloadframeworks_base-f59717ddb5ef324ee3fdb12b83e7d1b709793d28.zip
frameworks_base-f59717ddb5ef324ee3fdb12b83e7d1b709793d28.tar.gz
frameworks_base-f59717ddb5ef324ee3fdb12b83e7d1b709793d28.tar.bz2
Combine UsbManager.setPrimaryFunction and setDefaultFunction
Due to the property trigger on persist.sys.usb.config, setting the default function also sets the current function. Now we combine both of these methods into setCurrentFunction, which has a "makeDefault" option to make the new function the default. This change should eliminate some problems with setting properties due to multiple property triggers happening at the same time. Change-Id: I9851299e9c2ee20475eada1a8104c0d50bf5a9e1 Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'core/java/android/hardware')
-rw-r--r--core/java/android/hardware/usb/IUsbManager.aidl7
-rw-r--r--core/java/android/hardware/usb/UsbManager.java24
2 files changed, 7 insertions, 24 deletions
diff --git a/core/java/android/hardware/usb/IUsbManager.aidl b/core/java/android/hardware/usb/IUsbManager.aidl
index 2b9c082..9bab797 100644
--- a/core/java/android/hardware/usb/IUsbManager.aidl
+++ b/core/java/android/hardware/usb/IUsbManager.aidl
@@ -82,11 +82,8 @@ interface IUsbManager
/* Clears default preferences and permissions for the package */
void clearDefaults(String packageName);
- /* Sets the current primary USB function. */
- void setPrimaryFunction(String functions);
-
- /* Sets the default primary USB function. */
- void setDefaultFunction(String functions);
+ /* Sets the current USB function. */
+ void setCurrentFunction(String function, boolean makeDefault);
/* Sets the file path for USB mass storage backing file. */
void setMassStorageBackingFile(String path);
diff --git a/core/java/android/hardware/usb/UsbManager.java b/core/java/android/hardware/usb/UsbManager.java
index a828a23..67d200c 100644
--- a/core/java/android/hardware/usb/UsbManager.java
+++ b/core/java/android/hardware/usb/UsbManager.java
@@ -408,32 +408,18 @@ public class UsbManager {
}
/**
- * Sets the primary USB function.
+ * Sets the current USB function.
*
* @param function name of the USB function
+ * @param makeDefault true if this should be set as the default
*
* {@hide}
*/
- public void setPrimaryFunction(String function) {
+ public void setCurrentFunction(String function, boolean makeDefault) {
try {
- mService.setPrimaryFunction(function);
+ mService.setCurrentFunction(function, makeDefault);
} catch (RemoteException e) {
- Log.e(TAG, "RemoteException in setPrimaryFunction", e);
- }
- }
-
- /**
- * Sets the default primary USB function.
- *
- * @param function name of the USB function
- *
- * {@hide}
- */
- public void setDefaultFunction(String function) {
- try {
- mService.setDefaultFunction(function);
- } catch (RemoteException e) {
- Log.e(TAG, "RemoteException in setDefaultFunction", e);
+ Log.e(TAG, "RemoteException in setCurrentFunction", e);
}
}