FP1: Macadamia 1.9.9-pre3 Alpha (Android Kitkat)

Very weirg stuff happened to my phone during ski vacation: suddenly battery lasted longer that usual… I was very surprised that after several hours I was still around 80%.

Then I got a notification that the SD card was damaged… I took it out (managed to save all data on computer because for the computer it was not damaged) and then, without SD card battery life started dropping… after few hours I was at around 30%.

I formated the SD card, put it back still got a message that it’s damaged. Took it out again…

Battery life still not good…

I really don’t get it…

1 Like

Oh no, these are new issues … sounds bad. I will have a look asap.

I turned the second post into a wiki. Guys, can you please add your issues there (with a link to the topic or post describing it). Thanks.

3 Likes

I had that issue when sending videos via Telegram.
And it occurred to me with Android 4.2, too, so at least it’s no regression. :slight_smile:

1 Like

I added two issues (those that bug me the most, tbh). :slight_smile:

The Peace of Mind App from the Google Play Store from mudar.ca works perfect for me on the pre3

But the battery life is really not good :frowning:

1 Like

I’ve compiled the issues I experienced in this post.
I didn’t add them to the second post because I don’t in which way these issues impact others.

Issues that are new to Macadamia (sorted from bad to annoying):

Things that would be great and issues that have always been there (sorted from annoying to would-be-nice):

2 Likes

I can’t confirm the updater crashes. My updater here doesn’t crash, so that seems some other problem and not a bug.

2 Likes

Thanks a lot. You can file them as unconfirmed and let other people confirm them. If it affects two users, it is issue enough to be considered.

That’s certainly interesting because I can reproduce this at will just by restarting my phone or just starting the updated.
And I get a stacktrace which looks like a bug in the app.
Perhaps a clear of the download manager’s storage will help?
Edit: No.

03-02 14:34:24.580 D/su      (27434): 10160 com.fairphone.updater executing 0 /system/bin/sh using binary /system/bin/sh : sh
03-02 14:34:26.023 E/AndroidRuntime(27393): Process: com.fairphone.updater, PID: 27393
03-02 14:34:26.023 E/AndroidRuntime(27393): java.lang.RuntimeException: Unable to start service com.fairphone.updater.UpdaterService@422cef58 with Intent { cmp=com.fairphone.updater/.UpdaterService (has extras) }: java.lang.SecurityException: Invalid value for visibility: 2
03-02 14:34:26.023 E/AndroidRuntime(27393): 	at com.fairphone.updater.UpdaterService.startDownloadLatest(UpdaterService.java:255)
03-02 14:34:26.023 E/AndroidRuntime(27393): 	at com.fairphone.updater.UpdaterService.downloadConfigFile(UpdaterService.java:170)
03-02 14:34:26.023 E/AndroidRuntime(27393): 	at com.fairphone.updater.UpdaterService.onStartCommand(UpdaterService.java:112)
03-02 14:34:26.308 I/DEBUG   (27488): [OnPurpose Redunant in preset_info] pid: 27393, tid: -1361051648, name: UNKNOWN  >>> com.fairphone.updater <<<
03-02 14:34:28.253 I/WindowState(1751): WIN DEATH: Window{42fa1d88 u0 com.fairphone.updater/com.fairphone.updater.FairphoneUpdater}

Edit 2: According to Stack Overflow, this issue occurs when the app trying to download something tries to hide the download from the user but doesn’t have android.permission.DOWNLOAD_WITHOUT_NOTIFICATION (which holds true for the updater). So I guess the solution would be either to download without hiding the notification (eg. removing this line:

downloadRequest.setNotificationVisibility(DownloadManager.Request.VISIBILITY_HIDDEN);

) or giving the updater the required permission.

@jftr could you try this?

3 Likes

Thanks for the detailed investigation, @YtvwlD.

We have a fix lined up for that already. It is going to be in our upcoming releases. However, we did not consider it urgent, because afaik this should only ever happen if Updater is run as user app. This should not happen when Updater is installed as system app, which is the case for all our phones…

1 Like

I moved the updater from /system/app/ to /system/priv-app/ and it works now.

1 Like

@YtvwlD Thanks a lot for the tip, this solved the issue on my phone as well!

Thanks for finding this bug: Apparently we forgot to make Updater a privileged app when migrating (in JB all apps in /system/apps/ used to be privileged by default).

3 Likes

Can anybody here disable system apps in #kitkat ? I would like to disable the Browser.

Feature requests:

in 4.2.x There was a widget with some basic system settings switch on/off like:

  • Wlan
  • Bluetooth
  • Brightness of Screen
  • Data Synchronising
  • GPS

some other system settings you can reach via pull-down like some of the points above plus some more like:

  • Display timeout
  • Data Connection
  • Accu
  • Audio Profile

now, it seams that the widget is gone (or am I too stupid to find it?) and the pull-down setting menu has changed.

I think it would be a good practice to gather all the setting points in one place (widget OR pulldown), but more important is maybe the question what setting points should be in the menu.

actual collection (pre3) is ok, consists of there items:

  • Accu
  • Settings
  • Wlan (on/off)
  • Bluetooth (on/off)
  • GPS (on/off)
  • Flight-Mode (on/off)
  • Data Connection (on/off)
  • Data consumption
  • Audio Profile
  • Brightness of Screen
  • Screen Rotation (on/off)
  • Alarm Clock (if set)
  • new: Send Screen

what i miss (from Kola Nut) is:

  • Screen Time Out
  • from Widget: Data Synchronisation (on/off)

great work so far!

Thanks for collecting all these.

I can see whether the widget is still somewhere in the code. I am pretty sure there are similar widget to be found in several app stores.

About the other changes: They are part of the newer version of Android and we do not want to change them. I know that changes are often annoying (especially if features get thrown out) and I also know that not all changes to Android are for the better.

However, we do not want to deviate from Android source (unless necessary to get the phone working) because doing so makes it harder to maintain.

Thus, we won’t re-implement features and focus on the actual bugs we still have.

3 Likes

GravityBox allows you to change which buttons are in the pull-down menu and in which order.

2 Likes

I tried to connect my phone to a BLE heart-rate monitor yesterday.
I could see the device in the bluetooth settings and pairing didn’t work from there (that is the correct behaviour).
But the three apps I tried didn’t manage to find the device.
I’m trying to get more information on this isssue over the next days.

Has anybody tried this yet? Did it work?

Edit: Both BLExplorer and iBeaconDetector (both on F-Droid and on Google Play) detect a device, but I’m not sure if it’s the right one. BLExplorer does connect to a device but doesn’t return any information about it.

Edit 2:

iBeaconDetector was able to find the device.
BLExplorer was able to find the device and list its capabilities (but not read the concrete values).

I took a closer look at one of the apps I tried - RunnerUp. And I noticed these lines:

    static boolean AVOID_SCAN_WITH_UUID = false;
    static boolean CONNECT_IN_OWN_THREAD_FROM_ON_LE_SCAN = false;

    static {
        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR2) {
            // 4.3
            AVOID_SCAN_WITH_UUID = true;
            CONNECT_IN_OWN_THREAD_FROM_ON_LE_SCAN = true;
        }
}

So, Android 4.3 seems to be lacking certain features.
I replaced this with the following:

static boolean AVOID_SCAN_WITH_UUID = true;
static boolean CONNECT_IN_OWN_THREAD_FROM_ON_LE_SCAN = false;

And scanning for devices does work now.
Connecting does not.

So, what I’ve learned so far:

  • BLE devices have an ID and capabilities.
  • Apps can search for BLE devices.
  • They can add filters to scan only for BLE devices for certain capabilities.
  • The BLE stack in this ROM doesn’t support those filters.

The real solution would be to make filtering work.

The quick and dirty solution would be to simply ignore any filters set by apps in android.bluetooth.BluetoothAdapter:

public boolean startLeScan(UUID[] serviceUuids, LeScanCallback callback) {
    serviceUuids = null;
    […]

This could be made into an XPosed module easily, I guess. Maybe.

I’ll try setting the next variable to true.

Edit 3: Here’s the XPosed module:

The code is really just this:

findAndHookMethod("android.bluetooth.BluetoothAdapter", null, "startLeScan", UUID[].class, LeScanCallback.class, new XC_MethodHook() {
    @Override
    protected void beforeHookedMethod(XC_MethodHook.MethodHookParam param) throws Throwable
    {
        param.args[0] = null;
    }
});

Edit 4: I’ve tried setting the second variable to true. It didn’t help the connection.

So, the things I’ve learned so far:

  • The FP1 does have BLE support. It just doesn’t work the way it should.
  • Scanning for devices works mostly (eg. BLExplorer or iBeaconDetector or RunnerUp after the mentioned modification).
  • Filtering does not. Many apps know that and don’t bother setting a filter (eg. adidas train & run or Runtastic).
  • Discovering the services / properties a BLE device has works (eg. BLExplorer or RunnerUp).
  • Connecting to a BLE device does not.
  • Scanning for a BLE device does not work from some apps (eg. adidas train & run or Runtastic - the former one calls startLeScan very often).

Edit 5: What does happen when using RunnerUp is this:

  1. Enable Bluetooth.
  2. Scan.
  3. Found a device.
  4. Stop scan.
  5. Connect to the device.
  6. Connected.
  7. Start service discovery.
  8. Disconnected. (Should be “Discovered services.”.)

BLExplorer is able to list the services.

Edit 6: I bought a relatively cheap beacon.

BLExplorer is able to find the device and list its services. It is also able to read the values of one service per connection. (So I have to close the app and reopen it to read all services.)

The app made specifically for this device (Gigaset G-tag app) was able to find and connect to the device at the third attempt but lost the connection after about one minute.

Sometimes, the app Bluetooth-Freigabe (I don’t know its English name nor its package name, yet, sorry) crashes (I don’t have a stacktrace yet). No devices are being found afterwards until the next reboot.

Edit 7: This G-tag seems to work mostly. Sometimes, there are disconnects, but it reconnects very quickly. This is good, but doesn’t help with my heart rate monitor.

And I got a stack trace from the crashes of com.android.bluetooth somewhere in my logs. I just need to find it…

Edit 8: Here’s a stack trace:

E/[Bluetooth.OPP]BtOppRfcommListener(13444): Error accept connection java.io.IOException: read failed, socket might closed or timeout, read ret: -1
E/MTKBT   (13444): [Session]the session[61458][13444] is not ready to monitor
E/MTKBT   (13444): [Session]no any more session is in list
E/Bluetooth Transport(22023): Socket Type: Secureaccept() failed
E/Bluetooth Transport(22023): java.io.IOException: read failed, socket might closed or timeout, read ret: -1
E/Bluetooth Transport(22023):   at android.bluetooth.BluetoothSocket.readAll(BluetoothSocket.java:508)
E/Bluetooth Transport(22023):   at android.bluetooth.BluetoothSocket.waitSocketSignal(BluetoothSocket.java:485)
E/Bluetooth Transport(22023):   at android.bluetooth.BluetoothSocket.accept(BluetoothSocket.java:398)
E/Bluetooth Transport(22023):   at android.bluetooth.BluetoothServerSocket.accept(BluetoothServerSocket.java:131)
E/Bluetooth Transport(22023):   at android.bluetooth.BluetoothServerSocket.accept(BluetoothServerSocket.java:117)
E/Bluetooth Transport(22023):   at ewa.run(SourceFile:432)
E/CellLocation(14358): create GsmCellLocation
E/BluetoothRemoteDevices(13444): aclStateChangeCallback: Device is NULL
E/BluetoothTethering(12657): attempted to stop reverse tether with nothing tethered
E/bt_ext_apis.c(13444): create bt.ext.adp.hfp external socket failed : Address already in use, errno=98!

And here is the crash:

E/AndroidRuntime(13444): FATAL EXCEPTION: BluetoothAdapterState:
E/AndroidRuntime(13444): Process: com.android.bluetooth, PID: 13444
E/AndroidRuntime(13444): java.lang.NullPointerException
E/AndroidRuntime(13444):        at com.android.bluetooth.btservice.RemoteDevices$DeviceProperties.access$400(RemoteDevices.java:100)
E/AndroidRuntime(13444):        at com.android.bluetooth.btservice.RemoteDevices.sendUuidIntent(RemoteDevices.java:219)
E/AndroidRuntime(13444):        at com.android.bluetooth.btservice.RemoteDevices.access$1000(RemoteDevices.java:37)
E/AndroidRuntime(13444):        at com.android.bluetooth.btservice.RemoteDevices$1.handleMessage(RemoteDevices.java:455)
E/AndroidRuntime(13444):        at android.os.Handler.dispatchMessage(Handler.java:110)
E/AndroidRuntime(13444):        at android.os.Looper.loop(Looper.java:193)
E/AndroidRuntime(13444):        at android.os.HandlerThread.run(HandlerThread.java:61)

Edit 9: The system does return devices when an app scans for them (unless there’s a filter set). But many apps don’t display any found devices.

Edit 10: I tried going back to pre2. It’s basically the same.

Edit 11: I tried going back to the unofficial 4.4.4 build. It’s the same.

Scanning takes very long and eventually finds the correct device. But it takes a few attempts. Even if the two devices are directly near the phone.
I guess many apps run into a timeout before.
Improving the scanning process would be nice. (But not that important. We didn’t have BLE in 4.2 - now we have it but it doesn’t work.)

1 Like

The BLE functionality is a bit unreliable - see the dedicated thread “Bluetooth connections are unstable in FP1 alpha” thread

The system isn’t able to display the (the uppercase version of ß; U+1E9E; “latin capital letter sharp s”).

The fonts installed support it partially:

  • DroidSansFallback: nope
  • DroidSansMono: nope
  • DroidSerif-Regular: yep
  • Roboto: nope

It would be great if the fonts could be updated. (But not that important.)

2 Likes