Commit 09e9cba2 authored by Nick Pelly's avatar Nick Pelly
Browse files

Initial drop of Motorola Bluetooth OPP code.

Minor changes from Moto code:
- Added Motorola BSD license
- Moved com.motorola.bluetoothshare to com.android.bluetooth.opp
- Updated com.motorola.obex to javax.obex
- Moved Android.mk to Android.mk.hide: does not yet compile due to changes in
  Obex library.
parent 07562990
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := eng development
LOCAL_SRC_FILES := $(call all-subdir-java-files)
LOCAL_PACKAGE_NAME := BluetoothOpp
LOCAL_JAVA_LIBRARIES := javax.obex
include $(BUILD_PACKAGE)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.bluetooth.opp" >
<!-- Allows access to the Bluetooth Share Manager -->
<permission android:name="android.permission.ACCESS_BLUETOOTH_SHARE"
android:label="@string/permlab_bluetoothShareManager"
android:description="@string/permdesc_bluetoothShareManager"
android:protectionLevel="signature" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.ACCESS_BLUETOOTH_SHARE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application android:icon="@drawable/stat_sys_data_bt"
android:label="@string/app_name">
<uses-library android:name="javax.obex" />
<provider android:name=".BluetoothOppProvider"
android:authorities="com.android.bluetooth.opp"
android:permission="android.permission.ACCESS_BLUETOOTH_SHARE" />
<service android:name=".BluetoothOppService"
android:permission="android.permission.ACCESS_BLUETOOTH_SHARE" />
<receiver android:name=".BluetoothOppReceiver">
<intent-filter>
<action android:name="android.bluetooth.intent.action.BLUETOOTH_STATE_CHANGED" />
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<activity android:name="BluetoothOppLauncherActivity"
android:theme="@android:style/Theme.Dialog" android:label="@string/bt_share_picker_label">
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
<data android:mimeType="video/*" />
<data android:mimeType="text/x-vcard" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.ACTION_SHARE_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
<data android:mimeType="video/*" />
<data android:mimeType="x-mixmedia/*" />
</intent-filter>
<intent-filter>
<action android:name="android.btopp.intent.action.OPEN" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.item/vnd.android.btopp" />
</intent-filter>
</activity>
<activity android:name="BluetoothOppBtEnableActivity">
</activity>
<activity android:name="BluetoothOppBtErrorActivity">
</activity>
<activity android:name="BluetoothOppBtEnablingActivity">
android:theme="@android:style/Theme.Dialog"> </activity>
<activity android:name="BluetoothOppIncomingFileConfirmActivity">
</activity>
<activity android:name="BluetoothOppTransferActivity">
</activity>
<activity android:name="BluetoothDevicePickerActivity">
</activity>
<activity android:name="BluetoothPinDialog" android:label="@string/bluetooth_pin_entry"
android:theme="@*android:style/Theme.Dialog.Alert">
<intent-filter>
<action android:name="android.bluetooth.intent.action.PAIRING_REQUEST" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name="BluetoothOppLiveFolder"
android:label="@string/btopp_live_folder">
<intent-filter>
<action android:name="android.intent.action.CREATE_LIVE_FOLDER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.bluetooth.opp" >
<!-- Allows access to the Bluetooth Share Manager -->
<permission android:name="android.permission.ACCESS_BLUETOOTH_SHARE"
android:label="@string/permlab_bluetoothShareManager"
android:description="@string/permdesc_bluetoothShareManager"
android:protectionLevel="signatureOrSystem" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.ACCESS_BLUETOOTH_SHARE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application android:icon="@drawable/stat_sys_data_bt"
android:label="@string/app_name">
<uses-library android:name="javax.obex" />
<activity android:name=".TestActivity" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider android:name=".BluetoothOppProvider"
android:authorities="com.android.bluetooth.opp"
android:permission="android.permission.ACCESS_BLUETOOTH_SHARE" />
<service android:name=".BluetoothOppService"
android:permission="android.permission.ACCESS_BLUETOOTH_SHARE" />
<receiver android:name=".BluetoothOppReceiver">
<intent-filter>
<action android:name="android.bluetooth.intent.action.BLUETOOTH_STATE_CHANGED" />
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<activity android:name="BluetoothOppLauncherActivity"
android:theme="@android:style/Theme.Dialog" android:label="@string/bt_share_picker_label">
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
<data android:mimeType="video/*" />
<data android:mimeType="text/x-vcard" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.ACTION_SHARE_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
<data android:mimeType="video/*" />
<data android:mimeType="x-mixmedia/*" />
</intent-filter>
<intent-filter>
<action android:name="android.btopp.intent.action.OPEN" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.item/vnd.android.btopp" />
</intent-filter>
</activity>
<activity android:name="BluetoothOppBtEnableActivity">
</activity>
<activity android:name="BluetoothOppBtErrorActivity">
</activity>
<activity android:name="BluetoothOppBtEnablingActivity">
android:theme="@android:style/Theme.Dialog"> </activity>
<activity android:name="BluetoothOppIncomingFileConfirmActivity">
</activity>
<activity android:name="BluetoothOppTransferActivity">
</activity>
<activity android:name="BluetoothDevicePickerActivity">
</activity>
<activity android:name="BluetoothPinDialog" android:label="@string/bluetooth_pin_entry"
android:theme="@*android:style/Theme.Dialog.Alert">
<intent-filter>
<action android:name="android.bluetooth.intent.action.PAIRING_REQUEST" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name="BluetoothOppLiveFolder"
android:label="@string/btopp_live_folder">
<intent-filter>
<action android:name="android.intent.action.CREATE_LIVE_FOLDER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
res/drawable/ic_bt_cellphone.png

810 Bytes

res/drawable/ic_bt_laptop.png

3.15 KB

res/drawable/icon.png

3.11 KB

res/drawable/stat_sys_data_bt.png

852 Bytes

<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:orientation="vertical">
<TextView
android:id="@+id/message"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/text"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_marginTop="20dip"
android:layout_marginLeft="20dip"
android:layout_marginRight="20dip"
android:singleLine="true" />
</LinearLayout>
</ScrollView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ProgressBar android:id="@+android:id/progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/progress_info"
android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:layout_marginLeft="10px"
android:gravity="left"
/>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="@+id/content"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
android:title="@string/device_picker"/>
<Preference
android:key="bt_scan"
android:title="@string/bluetooth_preference_scan_title" />
<com.android.bluetooth.opp.ProgressCategory
android:key="bt_device_list"
android:title="@string/bluetooth_devices"
android:orderingFromXml="false" />
</PreferenceScreen>
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:id="@+id/line1_view"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginLeft="6px"
android:textSize="16sp"
android:text="@string/download_line1"/>
<TextView
android:id="@+id/line2_view"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginLeft="6px"
android:textSize="16sp"
android:text="@string/download_line2"/>
<TextView
android:id="@+id/line3_view"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginLeft="6px"
android:textSize="16sp"
android:text="@string/download_line3"/>
<TextView
android:id="@+id/line4_view"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginLeft="6px"
android:textSize="16sp"
android:text="@string/download_line4"/>
<TextView
android:id="@+id/line5_view"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:gravity="center"
android:textSize="16sp"
android:text="@string/download_line5"/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="@+id/progress_percent"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginLeft="10px"
android:gravity="left"
/>
<ProgressBar android:id="@+id/progress_transfer"
style="?android:attr/progressBarStyleHorizontal"
android:layout_marginLeft="10px"
android:layout_marginRight="10px"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:max="100"
android:progress="100" />
</LinearLayout>
</TableLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"
android:gravity="center_vertical"
android:paddingLeft="16dip"
android:paddingRight="?android:attr/scrollbarSize">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="6dip"
android:layout_marginTop="6dip"
android:layout_marginBottom="6dip"
android:layout_weight="1">
<TextView android:id="@+android:id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView android:id="@+android:id/summary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@android:id/title"
android:layout_alignLeft="@android:id/title"
android:textAppearance="?android:attr/textAppearanceSmall"
android:maxLines="2" />
</RelativeLayout>
<ImageView
android:id="@+id/btClass"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="12dip"
android:layout_gravity="center_vertical" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!-- Layout used for ProgressCategory in bluetooth settings. -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="27dip"
android:background="@*android:drawable/settings_header">
<TextView
android:id="@+android:id/title"
style="?android:attr/listSeparatorTextViewStyle"
/>
<ProgressBar
android:id="@+id/scanning_progress"
android:text="@string/progress_scanning"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="?android:attr/scrollbarSize"
style="?android:attr/progressBarStyleSmallTitle"
/>
<TextView
android:id="@+id/scanning_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="@id/scanning_progress"
android:textSize="18sp"
android:textColor="@android:color/primary_text_light"
android:layout_marginRight="5sp"
android:text="@string/progress_scanning"
/>
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@android:drawable/status_bar_item_app_background"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
>
<LinearLayout
android:layout_width="40dp"
android:layout_height="fill_parent"
android:orientation="vertical"
android:paddingTop="8dp"
android:focusable="true"
android:clickable="true"
>
<com.android.server.status.AnimatedImageView
android:id="@+id/appIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@android:drawable/sym_def_app_icon"
/>
<TextView android:id="@+id/progress_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ff000000"
android:singleLine="true"
android:textSize="14sp"
android:layout_gravity="center_horizontal"
/>
</LinearLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:focusable="true"
android:clickable="true"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:focusable="true"
android:clickable="true"
android:layout_alignParentTop="true"
android:paddingTop="10dp"
>
<TextView android:id="@+id/description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ff000000"
android:singleLine="true"
android:textSize="14sp"
android:paddingLeft="5dp"
/>
</LinearLayout>
<ProgressBar android:id="@+id/progress_bar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:paddingBottom="8dp"
android:paddingRight="25dp"
/>
</RelativeLayout>
</LinearLayout>
<com.android.server.status.AnimatedImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@android:drawable/divider_horizontal_bright"
/>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="3dip"
android:text="@string/Insert_record" />
<EditText
android:id="@+id/Insert_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left" >
<EditText
android:id="@+id/Media_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<EditText
android:id="@+id/Address_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<Button
android:id="@+id/Insert_record"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="3dip"
android:text="@string/OK_button" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="3dip"
android:text="@string/Delete_record" />
<EditText
android:id="@+id/Delete_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<Button
android:id="@+id/Delete_record"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="3dip"
android:text="@string/OK_button" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="3dip"
android:text="@string/Update_record" />
<EditText
android:id="@+id/Update_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<Button
android:id="@+id/Update_record"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="3dip"
android:text="@string/OK_button" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="3dip"
android:text="@string/Ack_record" />
<EditText
android:id="@+id/Ack_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<Button
android:id="@+id/Ack_record"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="3dip"
android:text="@string/OK_button" />
</LinearLayout>
<Button
android:id="@+id/DeleteAll_record"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/DeleteAll_record"></Button>
<Button
android:id="@+id/Start_server"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/Start_server"></Button>
<Button
android:id="@+id/Notify_server"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/Notify_server"></Button>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!--
This is the short description of a permission associated with the
Bluetooth Share Manager. It is displayed as part of the description of
any application that was granted that permission. This specific
permission controls access to the Bluetooth Share Manager by
applications that initiate Bluetooth share.
-->
<string name="permlab_bluetoothShareManager">Access download manager.</string>
<!--
This is the long description of a permission associated with the
Android Download Manager. It is displayed as part of the description
of any application that was granted that permission. This specific
permission controls access to the Download Manager by applications
that initiate downloads.
-->
<string name="permdesc_bluetoothShareManager">Allows the application to access the
BluetoothShare manager and to use it to transfer files. </string>
<!-- string showed on "Share picutre via" dialog -->
<string name="bt_share_picker_label">Bluetooth</string>
<!-- string for "unknown device" -->
<string name="unknown_device">Unknown device</string>
<!-- string for "the title of airplane mode error" -->
<string name="airplane_error_title">Airplane Mode</string>
<!-- string for "error message in airplane mode" -->
<string name="airplane_error_msg">Phone is currently in airplane mode, this
action is forbidden!</string>
<!-- strings for device picker start -->
<string name="screen_device_picker">Scan Bluetooth device</string>
<string name="progress_scanning">Scanning</string>
<string name="bluetooth_devices">Bluetooth devices</string>
<string name="bluetooth_settings">Bluetooth settings</string>
<string name="device_picker">Bluetooth device picker</string>
<string name="bluetooth_preference_scan_title">Scan for devices</string>
<string name="bluetooth_connected">Connected</string>
<!-- Bluetooth settings. Message when a device is disconnected -->
<string name="bluetooth_disconnected">Disconnected</string>
<!-- Bluetooth settings. Message when disconnecting from a device -->
<string name="bluetooth_disconnecting">Disconnecting</string>
<!-- Bluetooth settings. Message when connecting to a device -->
<string name="bluetooth_connecting">Connecting</string>
<!-- Bluetooth settings. Message when the device state is unknown -->
<string name="bluetooth_unknown"></string>
<!--
Bluetooth settings screen, summary text under individual Bluetooth
devices when not paired yet
-->
<string name="bluetooth_not_connected">Pair with this device</string>
<!--
Bluetooth settings screen, summary text when unable to turn on
Bluetooth
-->
<string name="bluetooth_failed_to_enable">Unable to turn on Bluetooth</string>
<!--
Bluetooth settings screen, summary text under individual Bluetooth
devices when failure to pair with one
-->
<string name="failed_to_pair">Unable to pair</string>
<!-- Title for BT error dialogs. -->
<string name="bluetooth_error_title">Attention</string>
<!-- Message for the error dialog when BT pairing fails generically. -->
<string name="bluetooth_pairing_error_message">There was a problem pairing.</string>
<!--
Notification ticker text (shown in the status bar) when a Bluetooth
device wants to pair with us
-->
<string name="bluetooth_notif_ticker">Bluetooth pairing request</string>
<!-- Notification title when a Bluetooth device wants to pair with us-->
<string name="bluetooth_notif_title">Pairing request</string>
<!--
Notification message when a Bluetooth device wants to pair with us
-->
<string name="bluetooth_notif_message">Select to pair with</string>
<!-- Title for the dialog to enter PIN. -->
<string name="bluetooth_pin_entry">Bluetooth pairing request</string>
<!-- Title for the bluetooth device info screen. -->
<string name="bluetooth_device_info">Bluetooth device info</string>
<!-- Message when the bluetooth is pairing with anotehr device -->
<string name="bluetooth_pairing_msg">Pairing</string>
<!-- Message when bluetooth dialog for pin entry is shwoing -->
<string name="bluetooth_enter_pin_msg">Type PIN to pair.</string>
<!-- Bluetooth Device Selection Dialog -->
<!--Title for "Bluetooth Device Selection Dialog" -->
<string name="devicepicker_title">Select Device</string>
<!--The label of the available devices list" -->
<string name="available_devices">Available Devices</string>
<!--Summary text to show in header when scanning -->
<string name="scanning">Scanning</string>
<!--
Summary text under individual Bluetooth devices when not paired with
one
-->
<string name="bluetooth_unpaired">Unpaired</string>
<!--
Summary text under individual Bluetooth devices when paired with one
-->
<string name="bluetooth_paired">Paired</string>
<!--Summary text under individual Bluetooth devices when pairing -->
<string name="bluetooth_pairing">Pairing</string>
<!-- Menu item to scan for nearby bluetooth devices -->
<string name="bluetooth_scan_for_devices">Scan for devices</string>
<!-- strings for device picker end -->
<!-- Activate Bluetooth Confirmation Dialog -->
<!--Title -->
<string name="bt_enable_title">Bluetooth</string>
<!--Line 1 -->
<string name="bt_enable_line1">To use Bluetooth services, you must first turn it
on.</string>
<!--Line 2 -->
<string name="bt_enable_line2">Turn on Bluetooth now?</string>
<!-- Label for a cancel button. -->
<string name="bt_enable_cancel">Cancel</string>
<!-- Label for a confirm button.-->
<string name="bt_enable_ok">Turn on</string>
<!-- Bluetooth File Transfer Acceptance Dialog -->
<!--Title -->
<string name="incoming_file_confirm_title">File Transfer</string>
<!--content -->
<string name="incoming_file_confirm_content">
<xliff:g id="devicename">%s1</xliff:g>
would like to send you
<xliff:g id="filename">%s2</xliff:g>
(
<xliff:g id="filesize">%s3</xliff:g>
). \n\n Would you like to accept the file?
</string>
<!-- Label for a cancel button. -->
<string name="incoming_file_confirm_cancel">Decline</string>
<!-- Label for a confirm button.-->
<string name="incoming_file_confirm_ok">Accept</string>
<!-- Bluetooth File Transfer Acceptance Notification item -->
<string name="incoming_file_confirm_Notification_title">Incoming file</string>
<string name="incoming_file_confirm_Notification_caption">Please confirm to receive this file</string>
<string name="incoming_file_toast_msg">There is an inoming file from another device, please confirm to receive this file</string>
<!-- Inbound File Transfer Progress Notification item -->
<!-- label for the notification item of receiving file -->
<string name="notification_receiving">
Receiving
<xliff:g id="filename">%s</xliff:g>
</string>
<!-- label for the notification item of received file -->
<string name="notification_received">
Received
<xliff:g id="filename">%s</xliff:g>
</string>
<!-- label for the notification item of received file -status -->
<string name="notification_received_complete">100% complete</string>
<!-- label for the notification item of failed receiving file -->
<string name="notification_received_fail">File not received: <xliff:g id="filename">%s</xliff:g></string>
<!-- Outbound File Transfer Progress Notification item -->
<!-- label for the notification item of sending file -->
<string name="notification_sending">Sending <xliff:g id="filename">%s</xliff:g></string>
<!-- label for the notification item of sending files -->
<string name="notification_sending_multi">Sending file</string>
<!-- label for the notification item of sent file -->
<string name="notification_sent">Sent <xliff:g id="filename">%s</xliff:g></string>
<!-- label for the notification item of sent file -status -->
<string name="notification_sent_complete">100% complete</string>
<!-- label for the notification item of failed sending file -->
<string name="notification_sent_fail">File not sent: <xliff:g id="filename">%s</xliff:g></string>
<!-- Bluetooth Download Progress Dialog -->
<!--Title -->
<string name="download_title">File Transfer</string>
<!--Line 1 -->
<string name="download_line1">From: <xliff:g id="destAddr">%s</xliff:g></string>
<!--Line 2 -->
<string name="download_line2">File: <xliff:g id="fileName">%s</xliff:g></string>
<!--Line 3 -->
<string name="download_line3">File size: <xliff:g id="fileSize">%s</xliff:g></string>
<!--Line 4 -->
<string name="download_line4"></string>
<string name="download_line5">Receiving file...</string>
<!-- Label for a cancel button. -->
<string name="download_cancel">Stop</string>
<!-- Label for a hide button.-->
<string name="download_ok">Hide</string>
<!-- Bluetooth failed Download Dialog -->
<!--Line 1 -->
<string name="download_fail_line1">File Not Received</string>
<!--Line 2 -->
<string name="download_fail_line2">File: <xliff:g id="filename">%s</xliff:g></string>
<!--Line 3 -->
<string name="download_fail_line3">Failure reason: <xliff:g id="failReason">%s</xliff:g></string>
<!-- Label for ok button.-->
<string name="download_fail_ok">OK</string>
<!-- Bluetooth Successful Download Dialog -->
<!--Line 4 in "Bluetooth Download Progress Dialog" -->
<string name="download_succ_line5">File received</string>
<!-- Label for a OK button.-->
<string name="download_succ_ok">Open</string>
<!-- Bluetooth Upload Progress Dialog -->
<string name="upload_line1">To: <xliff:g id="destAddr">%s</xliff:g></string>
<string name="upload_line3">File Type: <xliff:g id="fileType">%s1</xliff:g> (<xliff:g id="size">%s2</xliff:g>)</string>
<string name="upload_line5">Sending file...</string>
<!-- Bluetooth Successful Upload Progress Dialog -->
<!--Line 4 -->
<string name="upload_succ_line5">File sent</string>
<!-- Label for a confirm button.-->
<string name="upload_succ_ok">Ok</string>
<!-- Bluetooth Failed Upload File Transfer Dialog -->
<string name="upload_fail_line1">The file was not sent to <xliff:g id="destAddr">%s</xliff:g>.</string>
<string name="upload_fail_line1_2">File: <xliff:g id="fileName">%s</xliff:g></string>
<!-- Label for a try again button.-->
<string name="upload_fail_ok">Try Again</string>
<!-- Label for a cancel button.-->
<string name="upload_fail_cancel">Close</string>
<!-- Bluetooth error dialog -->
<string name="bt_error_btn_ok">OK</string>
<string name="unknown_file">Unknown file</string>
<string name="unknown_file_desc">There is no application to handle this file type. \n</string>
<string name="not_exist_file">File Not Exist</string>
<string name="not_exist_file_desc">The file is not existed! \n</string>
<!-- Bluetooth Enabling progress dialog -->
<string name="enabling_progress_title">Information</string>
<string name="enabling_progress_content">Turning on bluetooth..</string>
<!-- Bluetooth Toast Message -->
<string name="bt_toast_1">The file will be received. Check progress in the notifications window.</string>
<string name="bt_toast_2">The file will not be received.</string>
<string name="bt_toast_3">Stopped receiving file from <xliff:g id="destAddr">%s</xliff:g></string>
<string name="bt_toast_4">Sending file to <xliff:g id="destAddr">%s</xliff:g></string>
<string name="bt_toast_5">Sending <xliff:g id="fileNum">%s1</xliff:g> files to <xliff:g id="destAddr">%s2</xliff:g></string>
<string name="bt_toast_6">Stopped sending file to <xliff:g id="destAddr">%s</xliff:g></string>
<string name="bt_toast_7">Stopped sending <xliff:g id="fileNum">%s</xliff:g> files to <xliff:g id="destAddr">%s</xliff:g></string>
<!-- Bluetooth System Messages -->
<string name="bt_sm_2_1">There is not enough space on the memory card to save the file from <xliff:g id="deviceName">%s</xliff:g></string>
<string name="bt_sm_2_2">Space needed: <xliff:g id="spaceNeeded">%s</xliff:g></string>
<string name="bt_sm_3_1"><xliff:g id="deviceName">%s1</xliff:g> attempted to send you <xliff:g id="fileNum">%s2</xliff:g> files. </string>
<string name="bt_sm_3_2">However, this device can only receive one file at a time. Ask the other party to send the remaining <xliff:g id="fileNum">%s</xliff:g> files individually.</string>
<!-- Bluetooth Transfer Failure Messages -->
<string name="bt_tf_1"><xliff:g id="deviceName">%s</xliff:g> is unavailable.</string>
<string name="bt_tf_2">Cannot pair with <xliff:g id="deviceName">%s</xliff:g>.</string>
<string name="bt_tf_3">The connection was interrupted.</string>
<string name="bt_tf_4"><xliff:g id="deviceName">%s</xliff:g> does not support file transfers.</string>
<string name="bt_tf_5"><xliff:g id="deviceName">%s</xliff:g> cannot accept <xliff:g id="fileType">%s</xliff:g></string>
<string name="bt_tf_6"><xliff:g id="deviceName">%s</xliff:g> declined to accept the file.</string>
<string name="bt_tf_7">The file could not be sent.</string>
<string name="bt_tf_8">The file could not be received.</string>
<string name="bt_tf_10">Locked memory card. Unlock the memory card to save transferred files.</string>
<string name="bt_tf_12">There is a file being transferred to a different device. Please wait...</string>
<string name="bt_tf_13">Bluetooth is currently busy. Consider turning off another Bluetooth feature and trying again.</string>
<!-- Bluetooth Transfer Failure Reason -->
<string name="status_pending">File transfer not start yet</string>
<string name="status_running">File transfer is ongoing</string>
<string name="status_success">This transfer has successfully completed</string>
<string name="status_not_accept">The content type cannot be handled</string>
<string name="status_forbidden">This transfer is forbidden by target device</string>
<string name="status_canceled">This transfer was canceled by user</string>
<string name="status_file_error">Storage issue</string>
<string name="status_no_sd_card">No memory card, insert a memory card to save transferred files</string>
<string name="status_connection_error">Connection failure</string>
<string name="status_protocol_error">The request can not be handled correctly</string>
<string name="status_unknown_error">Unknown error</string>
<!-- Bluetooth OPP Live Folder -->
<string name="btopp_live_folder">Bluetooth Received</string>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, TestActivity</string>
<string name="app_name">Bluetooth Share</string>
<string name="Insert_record">Insert record</string>
<string name="Update_record">Confirm record</string>
<string name="Ack_record">Ack record</string>
<string name="DeleteAll_record">Delete All record</string>
<string name="OK_button">OK</string>
<string name="Delete_record">Delete record</string>
<string name="Start_server">Start TCP server</string>
<string name="Notify_server">Notify TCP server</string>
</resources>
/*
* Copyright (c) 2008-2009, Motorola, Inc.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* - Neither the name of the Motorola, Inc. nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package com.android.bluetooth.opp;
import java.util.List;
import java.util.WeakHashMap;
import android.os.Bundle;
import android.util.Log;
import android.util.Config;
import android.content.Intent;
/* for device picker */
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceScreen;
public class BluetoothDevicePickerActivity extends PreferenceActivity implements
BluetoothDevicePickerManager.Callback {
// public class BluetoothDevicePickerManager extends Activity {
static final int BASIC_PANEL = 0;
static final int ADVANCED_PANEL = 1;
private static final String LOG_TAG = "-------------BluetoothDevicePickerActivity";
private static final boolean DEBUG = true;
private static final boolean LOG_ENABLED = DEBUG ? Config.LOGD : Config.LOGV;
/* for device picker */
private static final String KEY_BT_DEVICE_LIST = "bt_device_list";
private static final String KEY_BT_SCAN = "bt_scan";
private ProgressCategory mDeviceList;
private WeakHashMap<BluetoothDevicePickerDevice, BluetoothDevicePickerDevicePreference> mDevicePreferenceMap = new WeakHashMap<BluetoothDevicePickerDevice, BluetoothDevicePickerDevicePreference>();
private BluetoothDevicePickerManager mLocalManager;
@Override
public void onCreate(Bundle icicle) {
log("onCreate");
super.onCreate(icicle);
addPreferencesFromResource(R.layout.device_picker);
mLocalManager = BluetoothDevicePickerManager.getInstance(this);
if (mLocalManager == null) {
log("mLocalManager is null");
finish();
}
mDeviceList = (ProgressCategory)findPreference(KEY_BT_DEVICE_LIST);
}
@Override
protected void onResume() {
super.onResume();
log("onResume");
mDevicePreferenceMap.clear();
mDeviceList.removeAll();
if (mLocalManager != null) {
mLocalManager.startBluetoothEventListener();
addDevices();
mLocalManager.registerCallback(this);
mLocalManager.setForegroundActivity(this);
}
}
@Override
public void onPause() {
super.onPause();
mLocalManager.unregisterCallback(this);
}
@Override
public void onStop() {
super.onStop();
if (mLocalManager != null) {
mLocalManager.stopBluetoothEventListener();
}
}
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
log("onPreferenceTreeClick");
if (KEY_BT_SCAN.equals(preference.getKey())) {
log("begin to scan");
mLocalManager.startScanning(true);
return super.onPreferenceTreeClick(preferenceScreen, preference);
} else if (preference instanceof BluetoothDevicePickerDevicePreference) {
log("user choosed a device");
BluetoothDevicePickerDevicePreference btPreference = (BluetoothDevicePickerDevicePreference)preference;
BluetoothDevicePickerDevice device = btPreference.getDevice();
// device.onClicked();
if (device.getPairingStatus() == BluetoothDevicePickerBtStatus.PAIRING_STATUS_PAIRED) {
log("the device chosed is paired, send intent to OPP with the BT address and finish this activity.");
String BtAddress = btPreference.getDevice().getAddress();
Intent intent = new Intent(BluetoothShare.BLUETOOTH_DEVICE_SELECTED_ACTION);
intent.setClassName("com.android.bluetooth.opp", BluetoothOppReceiver.class
.getName());
intent.putExtra("BT_ADDRESS", BtAddress);
this.sendBroadcast(intent);
super.onPreferenceTreeClick(preferenceScreen, preference);
finish();
} else {
log("the device chosed is NOT paired, try to pair with it and wait for bond request from bluez");
device.pair();
}
return super.onPreferenceTreeClick(preferenceScreen, preference);
}
return super.onPreferenceTreeClick(preferenceScreen, preference);
}
public void onScanningStateChanged(boolean started) {
log("onScanningStateChanged");
mDeviceList.setProgress(started);
}
public void onDeviceAdded(BluetoothDevicePickerDevice device) {
log("onDeviceAdded");
if (mDevicePreferenceMap.get(device) != null) {
throw new IllegalStateException("Got onDeviceAdded, but device already exists");
}
createDevicePreference(device);
}
public void onDeviceDeleted(BluetoothDevicePickerDevice device) {
BluetoothDevicePickerDevicePreference preference = mDevicePreferenceMap.remove(device);
if (preference != null) {
mDeviceList.removePreference(preference);
}
}
public void onBondingStateChanged(String address, boolean created) {
log("onBondingStateChanged");
if (created == true) {
Intent intent = new Intent(BluetoothShare.BLUETOOTH_DEVICE_SELECTED_ACTION);
intent
.setClassName("com.android.bluetooth.opp", BluetoothOppReceiver.class
.getName());
intent.putExtra("BT_ADDRESS", address);
this.sendBroadcast(intent);
log("the device bond succeeded, send intent to OPP");
}
finish();
}
private void addDevices() {
List<BluetoothDevicePickerDevice> devices = mLocalManager.getLocalDeviceManager()
.getDevicesCopy();
for (BluetoothDevicePickerDevice device : devices) {
onDeviceAdded(device);
}
}
private void createDevicePreference(BluetoothDevicePickerDevice device) {
log("createDevicePreference");
BluetoothDevicePickerDevicePreference preference = new BluetoothDevicePickerDevicePreference(
this, device);
mDeviceList.addPreference(preference);
mDevicePreferenceMap.put(device, preference);
}
static void log(String message) {
if (LOG_ENABLED) {
Log.v(LOG_TAG, message);
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment