Huawei: fixes related to replies

This commit is contained in:
Me7c7 2025-01-03 18:19:51 +02:00 committed by José Rebelo
parent 0429c2f3c8
commit 86e32f0713
4 changed files with 16 additions and 10 deletions

View File

@ -282,11 +282,15 @@ public class HuaweiCoordinator {
// Notifications
final List<Integer> notifications = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.NOTIFICATIONS);
notifications.add(R.xml.devicesettings_notifications_enable);
if (supportsNotificationsRepeatedNotify() || supportsNotificationsRemoveSingle()){
notifications.add(R.xml.devicesettings_autoremove_notifications);
}
if (supportsNotificationOnBluetoothLoss())
notifications.add(R.xml.devicesettings_disconnectnotification_noshed);
if (supportsDoNotDisturb(device))
notifications.add(R.xml.devicesettings_donotdisturb_allday_liftwirst_notwear);
// Workout
if (supportsSendingGps())
deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.WORKOUT, R.xml.devicesettings_workout_send_gps_to_band);

View File

@ -48,8 +48,7 @@ public class Notifications {
public String channelId = "";
public byte subscriptionId = 0;
public String address = "";
public String category = "";
}
// TODO: support other types of notifications
@ -129,7 +128,9 @@ public class Notifications {
if (addParams.supportsSyncKey)
this.tlv.put(0x18, (addParams.notificationKey != null) ? addParams.notificationKey : "");
//this.tlv.put(0x12, "msg"); //"msg" or "imcall", maybe other - category, if not empty and productType>=34
if(!TextUtils.isEmpty(addParams.category)) { //TODO: device type >=34
this.tlv.put(0x12, addParams.category); // "imcall" also possible value, not standard for android
}
//if(addParams.repeatedNotifySupports) {
// this.tlv.put(0x13, 0); // 0x13 - reminder 15 = vibrate, 0 - default
@ -142,8 +143,8 @@ public class Notifications {
if (addParams.supportsRepeatedNotify || addParams.supportsRemoveSingle) {
this.tlv.put(0x19, (addParams.notificationKey != null) ? addParams.notificationKey : "");
this.tlv.put(0x20, addParams.notificationId);
this.tlv.put(0x1d, (addParams.channelId != null) ? addParams.channelId : "");
this.tlv.put(0x1a, addParams.notificationId);
this.tlv.put(0x1b, (addParams.channelId != null) ? addParams.channelId : "");
}
if (addParams.supportsTimestamp) {
@ -347,8 +348,8 @@ public class Notifications {
.put(0x03, notificationKey)
.put(0x04, notificationId)
.put(0x05, notificationChannelId);
if (notificationCategory != null && !TextUtils.isEmpty(notificationCategory))
this.tlv.put(0x06, notificationCategory); // category
if (!TextUtils.isEmpty(notificationCategory))
this.tlv.put(0x06, notificationCategory);
this.complete = true;
}

View File

@ -81,8 +81,8 @@ public class HuaweiNotificationsManager {
notificationSpec.sourceAppId,
notificationSpec.key,
id,
"", // TODO:
null);
notificationSpec.channelId,
notificationSpec.category);
sendNotificationReq.doPerform();
} catch (IOException e) {
LOG.error("Sending notification remove failed", e);

View File

@ -76,6 +76,8 @@ public class SendNotificationRequest extends Request {
params.notificationId = notificationSpec.getId();
params.notificationKey = notificationSpec.key;
params.channelId = notificationSpec.channelId;
params.category = notificationSpec.category;
this.packet = new Notifications.NotificationActionRequest(
@ -92,7 +94,6 @@ public class SendNotificationRequest extends Request {
}
public void buildNotificationTLVFromCallSpec(CallSpec callSpec) {
this.packet = new Notifications.NotificationActionRequest(
paramsProvider,
supportProvider.getNotificationId(),