Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

Getting closer to installing Gear Manager on Nexus 7

OP blazespinnaker

27th October 2013, 11:54 PM   |  #1  
OP Member
Thanks Meter: 8
 
45 posts
Join Date:Joined: Oct 2013
For anyone who's trying, I've got closer to installing Galaxy Gear Manager on Nexus 7 (4.3 which has BLE). First, I just installed the app, but it would declare that it had to "Installing 0/19 ... 0%" and then just stop trying.

When I clicked "Connect Manually" it would pair and attempt, but I'd get the SsskUnsupportedException - Device Not Supported"

So I tried installing *all* the files here:

http://www.mediafire.com/folder/iej2...Android43)_All

I tested as I installed more and more, and basically whittled it down to 0/10 and then 0/2 files now that need to be installed when I start up the Gear Manager.

Anyone know what might be missing on that list? I'm hoping that those 2 remaining APKs might make a difference. Hopefully this will open things up to installing on any Android device (that has Bluetooth LE)


I've also been playing around with the various services/and activities via the am start command to try to pair without resetting the device:

Code:
am start com.android.bluetooth/.common.BluetoothPairingDialog
am start com.android.bluetooth/.common.BluetoothConnectActivity
am start com.android.bluetooth/.common.BluetoothSyncingActivity
am startservice com.android.bluetooth/.common.BluetoothAutoConnectService
Bit of a chore, but I got these using smali / dex2jar / JD Gui

Code:
adb pull /system/app/Bluetooth.odex
adb pull /system/framework/ framework (grab all the frameworks for baksmali)
./baksmali -a 15 -x Bluetooth.odex -d framework -o Bluetoot
./smali Bluetoot
d2j-dex2jar.sh out.dex
And then run JD Gui on them to figure out what's going on. I'm not sure, but there is a VendorSpecificCommand in the odex which might be what's causing the reset. If there was a way to avoid that, it might help. Hard to say.

Another idea might be to use bluez or something and do a command line pairing.

Here's a list of things I'm going to try to see if I can get this to work. If anyone has time to try one of these and let us know how it goes, that'd be great.

1. Use bluez or similar utility to pair from the command line
2. See if I can block the VendorSpecific command in Bluetooth.apk from causing us to reset
3. Decompile code and grep for Connection Failed message is exactly appearing when trying to pair between Nexus 7 and Galaxy Gear
4. Compare LogCats from a success case with a failed case and find the diff


Cheers,

Blaze.
Last edited by blazespinnaker; 1st November 2013 at 04:39 AM. Reason: Add debug detail
The Following 3 Users Say Thank You to blazespinnaker For This Useful Post: [ View ]
28th October 2013, 12:33 AM   |  #2  
OP Member
Thanks Meter: 8
 
45 posts
Join Date:Joined: Oct 2013
I pulled this list form the classes.dex in the gear.apk

com.android.calendar
com.android.email
com.android.incomingcall
com.android.mms
com.android.phone
com.android.settings
com.android.settings.ChooseLockGeneric
com.android.settings.REMOTE_NAME_CHANGED
com.facebook.katana
com.google.android.apps.plus
com.google.android.gm
com.google.android.googlequicksearchbox
com.google.android.talk
com.kddi.android.cmail
com.kddi.android.email
com.samsung.accessory
com.samsung.accessory.ContactsConsumerService.ui.c ontacts.AllContactsConsumerActivity
com.samsung.accessory.FindMyPhoneProviderService
com.samsung.accessory.ISAFTManager
com.samsung.accessory.action.DATA_RESTORE
com.samsung.accessory.action.FRAMEWORK_DIED2
com.samsung.accessory.adapter.action.STATE_CHANGED
com.samsung.accessory.adapter.extra.ERROR
com.samsung.accessory.adapter.extra.ERROR_ID
com.samsung.accessory.adapter.extra.READ_BYTES
com.samsung.accessory.adapter.extra.READ_LENGHT0
com.samsung.accessory.adapter.extra.SEND_TIMEOUT3
com.samsung.accessory.adapter.extra.SPACE_AVAILABL E
com.samsung.accessory.adapter.extra.STATE
com.samsung.accessory.api.DeathCallback
com.samsung.accessory.api.ISAFrameworkManager
com.samsung.accessory.clocksettingsprovider
com.samsung.accessory.ftconnection
com.samsung.accessory.saalarmprovider
com.samsung.accessory.sacalendarprovider
com.samsung.accessory.sacameratransferservice
com.samsung.accessory.sacontextprovider
com.samsung.accessory.safavsprovider
com.samsung.accessory.safiletransfer
com.samsung.accessory.safiletransfer.core.ISAFTMan ager
com.samsung.accessory.salogconsumer.ui.ConsumerAct ivity
com.samsung.accessory.salogprovider
com.samsung.accessory.samusicprovider
com.samsung.accessory.sanotiprovider
com.samsung.accessory.savmprovider
com.samsung.accessory.savmprovider.VRPolicyActivit y
com.samsung.android.aidl.ICancelInstallCallback
com.samsung.android.aidl.ICheckAppInstallState
com.samsung.android.aidl.ICheckAppInstallStateCall back
com.samsung.android.app.watchmanager
com.samsung.android.app.watchmanager.BManagerActiv ity
com.samsung.android.app.watchmanager.PairedWatchAc tivity
com.samsung.android.app.watchmanager.UpdateAlertDi alogActivityInstalled
com.samsung.android.app.watchmanager.UpdateAlertDi alogActivityServerSide
com.samsung.android.app.watchmanager.findmywatch.f romfindmywatchwidget.STOP
com.samsung.android.app.watchmanager.setting.Watch SettingsActivity
com.samsung.android.app.watchmanager.setupwizard.S etupWizardConnectActivity
com.samsung.android.app.watchmanager.setupwizard.S etupWizardEULAActivity
com.samsung.android.app.watchmanager.setupwizard.S etupWizardRestoreWatchSettingsActivity
com.samsung.android.app.watchmanager.setupwizard.S etupWizardWelcomeActivity
com.samsung.android.app.watchmanager.widget.SAPDIS CONNECT
com.samsung.android.app.watchmanager.widget.START
com.samsung.android.app.watchmanager.widget.STOP
com.samsung.android.app.watchmanager.widget.fromfi ndmywatchmenu.START
com.samsung.android.app.watchmanager.widget.fromfi ndmywatchmenu.STOP
com.samsung.android.permission.READ_FINDMYWATCHWID GET
com.samsung.android.permission.installApp
com.samsung.android.watchsns.provider
com.samsung.appcessory.callhandlerprovider
com.samsung.appcessory.chatonw.provider
com.samsung.bvoice.BVoiceActivity
com.samsung.bvoice
com.samsung.bvoice.BVoiceActivity
com.samsung.notifications
com.samsung.notifications.NotificationsActivity
com.samsung.svoiceprovider
com.samsung.wmanager.APP
com.samsung.wmanager.ENABLE_NOTIFICATION
com.samsung.wmanager.SAP_CHANNEL_CONNECTED
com.sds.mobiledesk
com.sec.android.app.clockpackage
com.sec.android.app.safetyassurance
com.sec.android.app.safetyassurance.SafetyAssuranc eGrantedReceiver
com.sec.android.app.safetyassurance.permission.PRI VATE_GRANTED
com.sec.android.app.safetyassurance.settings.SEND_ B_OPTION_INFO
com.sec.android.app.safetyassurance.settings.Safet yAssuranceSetting
com.sec.android.app.samsungapps
com.sec.android.app.secwmanagersetupwizard.WSETUPW IZARD_COMPLETE
com.sec.android.app.shortcutclock.WATCH_SHORTCUT_S ETTINGINFO
com.sec.android.daemonapp
com.sec.android.fotaprovider
com.sec.android.wallet
com.sec.android.weatherprovider
com.sec.android.widgetapp.ap.hero.accuweather
com.sec.android.widgetapp.watch.weatherclock
com.sec.chaton
com.sec.motions.MOTIONS_SETTINGS_CHANGED
com.twitter.android
28th October 2013, 02:32 AM   |  #3  
Noone has posted 1.4 and it's not available in my store yet, but latest 1.2.131013 is here:
http://www.mediafire.com/folder/e7h2...i/Gear_Manager

Then to get the other apk files, open the apk in a zip program (ie WinRAR, 7zip) and go to folder \assets\preInstallApks\
The Following User Says Thank You to Brendo For This Useful Post: [ View ]
28th October 2013, 06:42 AM   |  #4  
OP Member
Thanks Meter: 8
 
45 posts
Join Date:Joined: Oct 2013
Quote:
Originally Posted by Brendo

Noone has posted 1.4 and it's not available in my store yet, but latest 1.2.131013 is here:
http://www.mediafire.com/folder/e7h2...i/Gear_Manager

Then to get the other apk files, open the apk in a zip program (ie WinRAR, 7zip) and go to folder \assets\preInstallApks\

That helped. I've narrowed it down to these two suspects:

Code:
73 KB/s (104764 bytes in 0.132s)
	pkg: /data/local/tmp/SAMusicProvider_signed.apk
Failure [INSTALL_FAILED_SHARED_USER_INCOMPATIBLE]

1281 KB/s (158158 bytes in 0.120s)
	pkg: /data/local/tmp/SAWeatherProvider_signed.apk
Failure [INSTALL_FAILED_MISSING_SHARED_LIBRARY]
I believe SAWeatherProvider relies on TouchWiz. The shared user issue could probably be fixed easily enough. Not sure these libraries should be failing the connection.

Here's the logcat for the fail scenario after I click the paired device:

Code:
D/DeviceListActivity(19516): onItemClick()
D/DeviceListActivity(19516): onItemClick() address : D8:90:E8:A1:D1:8A
I/BluetoothAdapterProperties(  959): Callback:discoveryStateChangeCallback with state:0
W/DeviceListActivity(19516): pairing() address:D8:90:E8:A1:D1:8A device.getBondState():12
V/DD/SABtScan(17509): BluetoothAdapter.ACTION_DISCOVERY_FINISHED
V/BluetoothDiscoveryReceiver(19543): Received: android.bluetooth.adapter.action.DISCOVERY_FINISHED
D/DeviceListActivity(19516): pairing() state BOND_BONDED - mAddress is D8:90:E8:A1:D1:8A
D/DeviceListActivity(19516): onReceive() action:android.bluetooth.adapter.action.DISCOVERY_FINISHED
D/DeviceListActivity(19516): onReceive() ACTION_DISCOVERY_FINISHED count:1
V/SetupWizardConnectActivity(19516): onActivityResult()
V/SetupWizardConnectActivity(19516): onActivityResult() RESULT_OK
W/SetupWizardConnectActivity(19516): connectBTHeadset()[D8:90:E8:A1:D1:8A] mBluetoothHeadset = android.bluetooth.BluetoothHeadset@428f5bb0
W/SetupWizardConnectActivity(19516): mBluetoothHeadset.connect(device)
D/BluetoothHeadset(19516): connect(D8:90:E8:A1:D1:8A)
W/SetupWizardConnectActivity(19516): SetupWizardConnectActivity onResume()
I/BluetoothHeadsetServiceJni(  959): connectHfpNative: sBluetoothHfpInterface: 0x69151868
D/BluetoothAdapterProperties(  959): CONNECTION_STATE_CHANGE: D8:90:E8:A1:D1:8A: 0 -> 1
D/BluetoothAdapterService(1114653040)(  959): Get Bonded Devices being called
D/BluetoothAdapterProperties(  959): getBondedDevices: length=2
W/        (19516): mBTReceiver action = android.bluetooth.headset.profile.action.CONNECTION_STATE_CHANGED
D/SetupWizardConnectActivity(19516): BT HFP_STATE_CHANGED_ICS / state = 1
D/DeviceListActivity(19516): onReceive() action:android.bluetooth.headset.profile.action.CONNECTION_STATE_CHANGED
D/WManagerReceiver(19516): BManagerConnectionReceiver:android.bluetooth.headset.profile.action.CONNECTION_STATE_CHANGED
D/WManagerReceiver(19516): Bluetooth HFP_STATE_CHANGED ++ State : 1
D/BTHeadSetReceiver(19202): Action = android.bluetooth.headset.profile.action.CONNECTION_STATE_CHANGED
D/BTHeadSetReceiver(19202): mBTConn data = 1
D/DeviceListActivity(19516): onReceive() action:android.bluetooth.adapter.action.CONNECTION_STATE_CHANGED
I/ActivityManager(  434): Displayed com.samsung.android.app.watchmanager/.setupwizard.SetupWizardConnectActivity: +10s714ms
D/DeviceListActivity(19516): onStop() mIsResultOk:true
D/DeviceListActivity(19516): onDestroy() mBtAdapter.isDiscovering():false
I/BluetoothAdapterProperties(  959): Callback:discoveryStateChangeCallback with state:0
V/DD/SABtScan(17509): BluetoothAdapter.ACTION_DISCOVERY_FINISHED
V/BluetoothDiscoveryReceiver(19543): Received: android.bluetooth.adapter.action.DISCOVERY_FINISHED
W/bt-btif (  959): info:x10
D/        (  959): remote version info [d8:90:e8:a1:d1:8a]: 6, f, 220e
D/btif_config_util(  959): btif_config_save_file(L153): in file name:/data/misc/bluedroid/bt_config.new
W/DD/SABtScan(17509): unknown event received : android.bluetooth.device.action.ACL_CONNECTED
D/CompanionService(10769): bluetoothStateChangeReceiver action = android.bluetooth.device.action.ACL_CONNECTED
D/CompanionService(10769): device GALAXY Gear (D18A) @ [D8:90:E8:A1:D1:8A] BONDED
D/CompanionService(10769): Bluetooth device GALAXY Gear (D18A) @ [D8:90:E8:A1:D1:8A] BONDED has HSP|HFP.
D/CompanionService(10769): Headset device GALAXY Gear (D18A) @ [D8:90:E8:A1:D1:8A] BONDED connected.
D/HeadsetConnector(10769): Successfully invoked the getConnectedDevices method.
W/bt-sdp  (  959): process_service_search_attr_rsp
I/BluetoothHeadsetServiceJni(  959): connection_state_callback
D/BluetoothAdapterProperties(  959): CONNECTION_STATE_CHANGE: D8:90:E8:A1:D1:8A: 1 -> 0
D/BluetoothAdapterService(1114653040)(  959): Get Bonded Devices being called
D/BluetoothAdapterProperties(  959): getBondedDevices: length=2
W/        (19516): mBTReceiver action = android.bluetooth.headset.profile.action.CONNECTION_STATE_CHANGED
D/SetupWizardConnectActivity(19516): BT HFP_STATE_CHANGED_ICS / state = 0
D/SetupWizardConnectActivity(19516): STATE_DISCONNECTED
D/SetupWizardConnectActivity(19516): HFP_STATE_CHANGED_ICS state : 0 device Addr : D8:90:E8:A1:D1:8A device Name : GALAXY Gear (D18A)
D/SetupWizardConnectActivity(19516): BluetoothHeadset.STATE_DISCONNECTED mBtAddress : D8:90:E8:A1:D1:8A
D/SetupWizardConnectActivity(19516): Send message show connection fail
28th October 2013, 05:30 PM   |  #5  
Junior Member
Thanks Meter: 2
 
3 posts
Join Date:Joined: Oct 2013
Galaxy Gear paired with Nexus 4
Hi Blaze,

many thanks for you post!

I followed your steps and was able to manually pair the Gear with Nexus 4.

I've just installed all "com.samsung.accessory" APKs from your link and "com.sec.android.fotaprovider".

Both "music" and "weather" failed by me too but it doesn't matter (I don't think com.sec.android.fotaprovider is needed either).

After that I've just opened the Gear Manager for the second time (at first it said 0/19, second time it said 0/2), and chosen "Connect manually" to already paired device (I've done that earlier with some GearManager_1.2.apk) - and it worked!

Thanks once again,
Oleg
The Following User Says Thank You to OlegSkr For This Useful Post: [ View ]
29th October 2013, 12:32 AM   |  #6  
Would be handy to have an idea of which files are required. Am looking through all the files on my s4
29th October 2013, 06:24 PM   |  #7  
Member
Thanks Meter: 1
 
31 posts
Join Date:Joined: Oct 2013
Could I ask how you got it paired to nexus 4 is your phone rooted?? I keep getting connection failed. Unable to open gear manager installed all apk apart from 2 that won't install 0/2 but when I tried to connect manual gives me connection failed any help would be appreciated..

Sent from my Nexus 4 using xda app-developers app
30th October 2013, 03:23 PM   |  #8  
Junior Member
Thanks Meter: 2
 
3 posts
Join Date:Joined: Oct 2013
Hi beagle,

my Nexus 4 was rooted, but after some Android update it has lost its "su", and I don't think that this could be somehow relevant for the Galaxy Gear.

In fact, with Gear Manager 1.2 simple bluetooth pairing between the watch and the phone was never a problem, the handshake could be made and the watch was added to the phones BT-devices list.

The problem was, that after the handshake Gear Manager has told me: "Device not supported", or "Unsupported Ssdk", or something like that. So I took a look at the "com.samsung.android.app.watchmanager.1.2.131013.a pk" decompiled source code and found the following:

Code:
package com.samsung.android.sdk.accessory;

class SA implements SsdkInterface {
//...
  public void initialize(Context paramContext) throws SsdkUnsupportedException {

    if (!SsdkVendorCheck.isDeviceSupported(paramContext)) {
      throw new SsdkUnsupportedException("Device not supported", 1);
    }
    Log.d("Samsung Accessory SDK", "Samsung Accessory SDK version: " + this.mVersionName);
    this.mInitialized = true;
  }
//...
}
and here is how the "supported device" was checked:

Code:
package com.samsung.android.sdk.accessory;

public class SsdkVendorCheck
{
  private static String FRAMEWORK_PACKAGE_NAME = "com.samsung.accessory";
  private static String TAG = "SsdkVendorCheck";
  private static String strBrand = Build.BRAND;
  private static String strManufacturer = Build.MANUFACTURER;

  public static boolean isDeviceSupported(Context paramContext)
  {
    PackageManager localPackageManager = paramContext.getPackageManager();
    try
    {
      localPackageManager.getPackageInfo(FRAMEWORK_PACKAGE_NAME, 0);
      return true;
    }
    catch (PackageManager.NameNotFoundException localNameNotFoundException)
    {
      Log.e(TAG, "Samsung Accessory Framework not installed");
      localNameNotFoundException.printStackTrace();
    }
    return false;
  }

  public static boolean isSamsungDevice()
  {
    if ((strBrand == null) || (strManufacturer == null));
    while ((strBrand.compareToIgnoreCase("Samsung") != 0) && (strManufacturer.compareToIgnoreCase("Samsung") != 0))
      return false;
    return true;
  }
}
So theoretically, in my case all I had to do - was to create my own app, with the package "com.samsung.accessory" - and it would be sufficient to unlock the watch through the Nexus 4.

But I have not tried that out, I have found this thread and decided to install all the "com.samsung.*" apks, just to be sure.

And also they have changed this security check in the version 1.4, at least the GearManager 1.4 won't event start on my Nexus 4, I assume they are also checking the "SsdkVendorCheck.isSamsungDevice()" now in the "SA.initialize()", but I have not looked further into it.

I have also a definitely unrooted Nexus 7, I'll try to connect it with the watch when I have the time.
And I will try to use at first my own app as described above, than just a subset of the SA-apps to find out which of them are really needed. But I probably won't have the time for that till next week.

P.S. could you please upload the screenshot of that "connection failed" message?
The Following User Says Thank You to OlegSkr For This Useful Post: [ View ]
30th October 2013, 04:28 PM   |  #9  
Member
Thanks Meter: 1
 
31 posts
Join Date:Joined: Oct 2013
Hi mate thanks for the reply..complete novice here! Connection failed message shows up on nexus 4 gear manager screen the watch just says Bluetooth connected then did connected again...I've had the watch paired to a s3 so know it works any help would be appreciated don't want to change my nexus 4 to get gear to work.

Sent from my Nexus 4 using xda app-developers app
31st October 2013, 04:07 AM   |  #10  
OP Member
Thanks Meter: 8
 
45 posts
Join Date:Joined: Oct 2013
Quote:
Originally Posted by beagle1974

Hi mate thanks for the reply..complete novice here! Connection failed message shows up on nexus 4 gear manager screen the watch just says Bluetooth connected then did connected again...I've had the watch paired to a s3 so know it works any help would be appreciated don't want to change my nexus 4 to get gear to work.

Sent from my Nexus 4 using xda app-developers app

Interesting, I couldn't find that error message exactly but I think com.samsung.android.sdk.accessory.SAAgent is possibly involved in producing the error state:

Code:
private boolean handleMakeServiceConnectionAtomic(SAPeerAgent paramSAPeerAgent)
    throws SAException
  {
    Log.i(TAG, "handleMakeServiceConnection: Send connection request , Waiting to  accept connection");
    SAAdapter localSAAdapter = SAAdapterAccessor.getDefault().getDefaultAdapter(getApplicationContext());
    SharedPreferences localSharedPreferences = getApplicationContext().getSharedPreferences("AccessoryPreferences", 0);
    String str = localSharedPreferences.getString(getClass().getName(), null);
    if (str == null)
    {
      handleReRegisterAfterClearData();
      str = localSharedPreferences.getString(getClass().getName(), null);
      if (str == null)
      {
        Log.i(TAG, "handleMakeServiceConnectionAtomic: Even after restoring from Framework registeredKey is null. Nothing can be done");
        onServiceConnectionResponse(null, 2048);
      }
    }
    SAServiceDescription localSAServiceDescription = SAConfigUtil.getDefultInstance(getApplicationContext()).fetchServicesDescription(getClass().getName());
    try
    {
      Log.d(TAG, "Is Member class" + String.valueOf(this.mConnHandlerAsImplementedbyCaller.isMemberClass()));
      SASocket localSASocket;
      if ((this.mConnHandlerAsImplementedbyCaller.getEnclosingClass() != null) && (SAAgent.class.isAssignableFrom(this.mConnHandlerAsImplementedbyCaller.getEnclosingClass())))
      {
        Log.d(TAG, "Enclosing class for ConnectionHelper:" + this.mConnHandlerAsImplementedbyCaller.getEnclosingClass().getSimpleName());
        Class localClass = this.mConnHandlerAsImplementedbyCaller;
        Class[] arrayOfClass = new Class[1];
        arrayOfClass[0] = this.mConnHandlerAsImplementedbyCaller.getEnclosingClass();
        localSASocket = (SASocket)localClass.getDeclaredConstructor(arrayOfClass).newInstance(new Object[] { this });
      }
      for (boolean bool = localSASocket.setupInitiator(this, str, paramSAPeerAgent, localSAServiceDescription, localSAAdapter); bool == true; bool = localSASocket.setupInitiator(this, str, paramSAPeerAgent, localSAServiceDescription, localSAAdapter))
      {
        this.mServiceState = 1;
        Log.i(TAG, "onServiceConnectionResponse: CONNECTION_SUCCESS for " + getClass().getSimpleName());
        this.mSuccessfulConnections.add(localSASocket);
        onServiceConnectionResponse(localSASocket, 0);
        localSASocket.setReadyToReceive();
        return true;
        localSASocket = (SASocket)this.mConnHandlerAsImplementedbyCaller.getDeclaredConstructor(new Class[0]).newInstance(new Object[0]);
      }
      this.mServiceState = 0;
      int i = resolveConnectionError(SAAdapterAccessor.getDefault().getLastErrorCode(localSAAdapter));
      Log.i(TAG, "onServiceConnectionResponse: CONNECTION_FAIL for " + getClass().getSimpleName());
      onServiceConnectionResponse(null, i);
      return false;
    }
    catch (InstantiationException localInstantiationException)
    {
      Log.e(TAG, "Unable to create Connection helper instance", localInstantiationException);
      Log.i(TAG, "onServiceConnectionResponse: CONNECTION_FAILED");
      onServiceConnectionResponse(null, 1027);
      return false;
    }
    catch (IllegalAccessException localIllegalAccessException)
    {
      while (true)
        Log.e(TAG, "Unable to create Connection helper instance", localIllegalAccessException);
    }
    catch (IllegalArgumentException localIllegalArgumentException)
    {
      while (true)
        Log.e(TAG, "Unable to create Connection helper instance", localIllegalArgumentException);
    }
    catch (InvocationTargetException localInvocationTargetException)
    {
      while (true)
        Log.e(TAG, "Unable to create Connection helper instance", localInvocationTargetException);
    }
    catch (NoSuchMethodException localNoSuchMethodException)
    {
      while (true)
        Log.e(TAG, "Unable to create Connection helper instance", localNoSuchMethodException);
    }
  }

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes