forked from Blendman974/faceclaw
Many bug fixes
This commit is contained in:
1 parent
602520a840
commit
0d0b55c2da
9 files changed
+125
-25
No files matched your search
@@ -108,10 +108,10 @@ public class BleProtocol {
|
||||
public static byte[] buildImageRawData(ImageTileOptions tile, int sessionId, int totalSize, ImageFragment fragment, int magic) {
|
||||
List<byte[]> inner = new ArrayList<>();
|
||||
inner.add(encodeVarintField(1, tile.containerId));
|
||||
inner.add(encodeStringField(2, tile.name));
|
||||
//inner.add(encodeStringField(2, tile.name));
|
||||
inner.add(encodeVarintField(3, sessionId));
|
||||
inner.add(encodeVarintField(4, totalSize));
|
||||
inner.add(encodeVarintField(5, 0)); //compression
|
||||
//inner.add(encodeVarintField(5, 0)); //compression
|
||||
inner.add(encodeVarintField(6, fragment.index));
|
||||
inner.add(encodeVarintField(7, fragment.size));
|
||||
inner.add(encodeBytesField(8, fragment.data));
|
||||
|
||||
@@ -854,13 +854,15 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
||||
if (!synchronizedCommits) {
|
||||
for (TileImagePlan plan : changedTiles) {
|
||||
for (BleProtocol.ImageFragment fragment : plan.fragments) {
|
||||
enqueueImageFragmentLocked(plan, fragment, fingerprint, updateId, messageNumber++, messageCount, nextTransportSeq++, true, true);
|
||||
boolean requestAck = fragment.index % 2 == 1;
|
||||
enqueueImageFragmentLocked(plan, fragment, fingerprint, updateId, messageNumber++, messageCount, nextTransportSeq++, requestAck, true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (TileImagePlan plan : changedTiles) {
|
||||
for (int i = 0; i < plan.fragments.size() - 1; i++) {
|
||||
enqueueImageFragmentLocked(plan, plan.fragments.get(i), fingerprint, updateId, messageNumber++, messageCount, nextTransportSeq++, true, false);
|
||||
boolean requestAck = i % 2 == 1;
|
||||
enqueueImageFragmentLocked(plan, plan.fragments.get(i), fingerprint, updateId, messageNumber++, messageCount, nextTransportSeq++, requestAck, false);
|
||||
}
|
||||
}
|
||||
for (TileImagePlan plan : changedTiles) {
|
||||
@@ -884,7 +886,7 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
||||
boolean requestAck,
|
||||
boolean isLast
|
||||
) {
|
||||
int magic = IMAGE_FRAGMENT_NO_ACK ? 0 : nextMagic();
|
||||
int magic = requestAck ? nextMagic() : 0;
|
||||
OutboundMessage message = new OutboundMessage(
|
||||
"image",
|
||||
"image " + plan.tile.name + "#" + fragment.index,
|
||||
|
||||
+14
-2
@@ -1,15 +1,19 @@
|
||||
package com.faceclaw.app;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ServiceInfo;
|
||||
import android.os.Build;
|
||||
import android.os.IBinder;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.tns.NativeScriptActivity;
|
||||
|
||||
public class FaceclawForegroundService extends Service {
|
||||
@@ -102,7 +106,15 @@ public class FaceclawForegroundService extends Service {
|
||||
}
|
||||
|
||||
private int foregroundServiceType() {
|
||||
return ServiceInfo.FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE
|
||||
| ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE;
|
||||
int type = ServiceInfo.FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE;
|
||||
if (hasRecordAudioPermission()) {
|
||||
type |= ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
private boolean hasRecordAudioPermission() {
|
||||
return ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO)
|
||||
== PackageManager.PERMISSION_GRANTED;
|
||||
}
|
||||
}
|
||||
@@ -32,11 +32,25 @@
|
||||
|
||||
<!-- theme for action-bar -->
|
||||
<style name="NativeScriptToolbarStyleBase" parent="Widget.AppCompat.Toolbar">
|
||||
<item name="android:background">@color/ns_primary</item>
|
||||
<item name="theme">@style/ThemeOverlay.AppCompat.ActionBar</item>
|
||||
<item name="popupTheme">@style/ThemeOverlay.AppCompat</item>
|
||||
<item name="android:background">#424242</item>
|
||||
<item name="theme">@style/NativeScriptToolbarTheme</item>
|
||||
<item name="popupTheme">@style/NativeScriptToolbarPopupTheme</item>
|
||||
</style>
|
||||
|
||||
<style name="NativeScriptToolbarStyle" parent="NativeScriptToolbarStyleBase">
|
||||
</style>
|
||||
|
||||
<style name="NativeScriptToolbarTheme" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
|
||||
<item name="android:textColorPrimary">#FFFFFF</item>
|
||||
<item name="android:textColorSecondary">#FFFFFF</item>
|
||||
<item name="colorControlNormal">#FFFFFF</item>
|
||||
<item name="actionMenuTextColor">#FFFFFF</item>
|
||||
</style>
|
||||
|
||||
<style name="NativeScriptToolbarPopupTheme" parent="ThemeOverlay.AppCompat.Light">
|
||||
<item name="android:colorBackground">#FFFFFF</item>
|
||||
<item name="android:textColorPrimary">#222222</item>
|
||||
<item name="android:textColorSecondary">#555555</item>
|
||||
<item name="colorControlNormal">#222222</item>
|
||||
</style>
|
||||
</resources>
|
||||
Reference in new issue
Block a user