diff options
7 files changed, 39 insertions, 16 deletions
diff --git a/libs/usb/tests/AccessoryChat/AndroidManifest.xml b/libs/usb/tests/AccessoryChat/AndroidManifest.xml index 37ab29f..802b715 100644 --- a/libs/usb/tests/AccessoryChat/AndroidManifest.xml +++ b/libs/usb/tests/AccessoryChat/AndroidManifest.xml @@ -17,7 +17,7 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.accessorychat"> - <application> + <application android:label="Accessory Chat"> <uses-library android:name="com.android.future.usb.accessory" /> <activity android:name="AccessoryChat" android:label="Accessory Chat"> diff --git a/libs/usb/tests/AccessoryChat/accessorychat/accessorychat.c b/libs/usb/tests/AccessoryChat/accessorychat/accessorychat.c index c80b7c4..85b52dd 100644 --- a/libs/usb/tests/AccessoryChat/accessorychat/accessorychat.c +++ b/libs/usb/tests/AccessoryChat/accessorychat/accessorychat.c @@ -67,11 +67,11 @@ static void* write_thread(void* arg) { } static void milli_sleep(int millis) { - struct timespec tm; + struct timespec tm; - tm.tv_sec = 0; - tm.tv_nsec = millis * 1000000; - nanosleep(&tm, NULL); + tm.tv_sec = 0; + tm.tv_nsec = millis * 1000000; + nanosleep(&tm, NULL); } static void send_string(struct usb_device *device, int index, const char* string) { @@ -155,7 +155,7 @@ static int usb_device_added(const char *devname, void* client_data) { send_string(device, ACCESSORY_STRING_MANUFACTURER, "Google, Inc."); send_string(device, ACCESSORY_STRING_MODEL, "AccessoryChat"); - send_string(device, ACCESSORY_STRING_DESCRIPTION, "Sample Program"); + send_string(device, ACCESSORY_STRING_DESCRIPTION, "Accessory Chat"); send_string(device, ACCESSORY_STRING_VERSION, "1.0"); send_string(device, ACCESSORY_STRING_URI, "http://www.android.com"); send_string(device, ACCESSORY_STRING_SERIAL, "1234567890"); diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index 8998674..b4eea6e 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -129,7 +129,7 @@ <string name="usb_accessory_confirm_prompt">Open %1$s when this USB accessory is connected?</string> <!-- Prompt for the USB accessory URI dialog [CHAR LIMIT=80] --> - <string name="usb_accessory_uri_prompt">Additional information for this device may be found at: %1$s</string> + <string name="usb_accessory_uri_prompt">Additional information for this USB accessory may be found at: %1$s</string> <!-- Title for USB accessory dialog. Used when the name of the accessory cannot be determined. [CHAR LIMIT=50] --> <string name="title_usb_accessory">USB accessory</string> @@ -137,7 +137,10 @@ <!-- View button label for USB dialogs. [CHAR LIMIT=15] --> <string name="label_view">View</string> - <!-- Ignore button label for USB dialogs. [CHAR LIMIT=15] --> - <string name="label_ignore">Ignore</string> + <!-- Checkbox label for USB device dialogs. [CHAR LIMIT=50] --> + <string name="always_use_device">Use by default for this USB device</string> + + <!-- Checkbox label for USB accessory dialogs. [CHAR LIMIT=50] --> + <string name="always_use_accessory">Use by default for this USB accessory</string> </resources> diff --git a/packages/SystemUI/src/com/android/systemui/usb/UsbAccessoryUriActivity.java b/packages/SystemUI/src/com/android/systemui/usb/UsbAccessoryUriActivity.java index eefb1c6..5007cf4 100644 --- a/packages/SystemUI/src/com/android/systemui/usb/UsbAccessoryUriActivity.java +++ b/packages/SystemUI/src/com/android/systemui/usb/UsbAccessoryUriActivity.java @@ -76,7 +76,7 @@ public class UsbAccessoryUriActivity extends AlertActivity } ap.mMessage = getString(R.string.usb_accessory_uri_prompt, mUri); ap.mPositiveButtonText = getString(R.string.label_view); - ap.mNegativeButtonText = getString(R.string.label_ignore); + ap.mNegativeButtonText = getString(android.R.string.cancel); ap.mPositiveButtonListener = this; ap.mNegativeButtonListener = this; diff --git a/packages/SystemUI/src/com/android/systemui/usb/UsbConfirmActivity.java b/packages/SystemUI/src/com/android/systemui/usb/UsbConfirmActivity.java index 2781246..030a261 100644 --- a/packages/SystemUI/src/com/android/systemui/usb/UsbConfirmActivity.java +++ b/packages/SystemUI/src/com/android/systemui/usb/UsbConfirmActivity.java @@ -80,8 +80,8 @@ public class UsbConfirmActivity extends AlertActivity ap.mMessage = getString(R.string.usb_device_confirm_prompt, appName); mDisconnectedReceiver = new UsbDisconnectedReceiver(this, mDevice); } - ap.mPositiveButtonText = getString(com.android.internal.R.string.ok); - ap.mNegativeButtonText = getString(com.android.internal.R.string.cancel); + ap.mPositiveButtonText = getString(android.R.string.ok); + ap.mNegativeButtonText = getString(android.R.string.cancel); ap.mPositiveButtonListener = this; ap.mNegativeButtonListener = this; @@ -90,7 +90,11 @@ public class UsbConfirmActivity extends AlertActivity Context.LAYOUT_INFLATER_SERVICE); ap.mView = inflater.inflate(com.android.internal.R.layout.always_use_checkbox, null); mAlwaysUse = (CheckBox)ap.mView.findViewById(com.android.internal.R.id.alwaysUse); - mAlwaysUse.setText(com.android.internal.R.string.alwaysUse); + if (mDevice == null) { + mAlwaysUse.setText(R.string.always_use_accessory); + } else { + mAlwaysUse.setText(R.string.always_use_device); + } mAlwaysUse.setOnCheckedChangeListener(this); mClearDefaultHint = (TextView)ap.mView.findViewById( com.android.internal.R.id.clearDefaultHint); diff --git a/packages/SystemUI/src/com/android/systemui/usb/UsbPermissionActivity.java b/packages/SystemUI/src/com/android/systemui/usb/UsbPermissionActivity.java index 27cce6d..c384f50 100644 --- a/packages/SystemUI/src/com/android/systemui/usb/UsbPermissionActivity.java +++ b/packages/SystemUI/src/com/android/systemui/usb/UsbPermissionActivity.java @@ -91,8 +91,8 @@ public class UsbPermissionActivity extends AlertActivity ap.mMessage = getString(R.string.usb_device_permission_prompt, appName); mDisconnectedReceiver = new UsbDisconnectedReceiver(this, mDevice); } - ap.mPositiveButtonText = getString(com.android.internal.R.string.ok); - ap.mNegativeButtonText = getString(com.android.internal.R.string.cancel); + ap.mPositiveButtonText = getString(android.R.string.ok); + ap.mNegativeButtonText = getString(android.R.string.cancel); ap.mPositiveButtonListener = this; ap.mNegativeButtonListener = this; @@ -101,7 +101,11 @@ public class UsbPermissionActivity extends AlertActivity Context.LAYOUT_INFLATER_SERVICE); ap.mView = inflater.inflate(com.android.internal.R.layout.always_use_checkbox, null); mAlwaysUse = (CheckBox)ap.mView.findViewById(com.android.internal.R.id.alwaysUse); - mAlwaysUse.setText(com.android.internal.R.string.alwaysUse); + if (mDevice == null) { + mAlwaysUse.setText(R.string.always_use_accessory); + } else { + mAlwaysUse.setText(R.string.always_use_device); + } mAlwaysUse.setOnCheckedChangeListener(this); mClearDefaultHint = (TextView)ap.mView.findViewById( com.android.internal.R.id.clearDefaultHint); diff --git a/packages/SystemUI/src/com/android/systemui/usb/UsbResolverActivity.java b/packages/SystemUI/src/com/android/systemui/usb/UsbResolverActivity.java index 7c63820..f61ecb1 100644 --- a/packages/SystemUI/src/com/android/systemui/usb/UsbResolverActivity.java +++ b/packages/SystemUI/src/com/android/systemui/usb/UsbResolverActivity.java @@ -31,6 +31,9 @@ import android.os.Parcelable; import android.os.RemoteException; import android.os.ServiceManager; import android.util.Log; +import android.widget.CheckBox; + +import com.android.systemui.R; import java.util.ArrayList; @@ -58,6 +61,15 @@ public class UsbResolverActivity extends ResolverActivity { super.onCreate(savedInstanceState, target, title, null, rList, true /* Set alwaysUseOption to true to enable "always use this app" checkbox. */ ); + CheckBox alwaysUse = (CheckBox)findViewById(com.android.internal.R.id.alwaysUse); + if (alwaysUse != null) { + if (mDevice == null) { + alwaysUse.setText(R.string.always_use_accessory); + } else { + alwaysUse.setText(R.string.always_use_device); + } + } + mDevice = (UsbDevice)target.getParcelableExtra(UsbManager.EXTRA_DEVICE); if (mDevice != null) { mDisconnectedReceiver = new UsbDisconnectedReceiver(this, mDevice); |