Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Battery level related changes #1242

Merged
merged 3 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1512,10 +1512,10 @@ private void appendAppNotesToCrashReport(String aNotes) {
@Keep
@SuppressWarnings("unused")
private void updateControllerBatteryLevels(final int leftLevel, final int rightLevel) {
runOnUiThread(() -> updateBatterLevels(leftLevel, rightLevel));
runOnUiThread(() -> updateBatteryLevels(leftLevel, rightLevel));
}

private void updateBatterLevels(final int leftLevel, final int rightLevel) {
private void updateBatteryLevels(final int leftLevel, final int rightLevel) {
long currentTime = System.nanoTime();
if (((currentTime - mLastBatteryUpdate) >= BATTERY_UPDATE_INTERVAL) || mLastBatteryLevel == -1) {
mLastBatteryUpdate = currentTime;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ public void updateUI() {
.withDensity(R.dimen.tray_tooltip_density)
.withLayout(R.layout.tooltip)
.withString(getContext().getString(
R.string.tray_status_headset,
DeviceType.isTetheredDevice() ? R.string.tray_status_phone : R.string.tray_status_headset,
String.format(
LocaleUtils.getDisplayLanguage(
getContext()).getLocale(),
Expand Down
4 changes: 4 additions & 0 deletions app/src/common/shared/com/igalia/wolvic/utils/DeviceType.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,8 @@ public static String getDeviceName(Context aContext) {
}
return aContext.getString(R.string.device_name, appName, deviceName);
}

public static boolean isTetheredDevice() {
return mType == HVR3DoF || mType == HVR6DoF || mType == VisionGlass || mType == LenovoA3;
}
}
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2532,5 +2532,7 @@ the Select` button. When clicked it closes all the previously selected tabs -->

<!-- Shown in the tray wifi icon popup when SSID cannot be retrieved -->
<string name="tray_wifi_unavailable_ssid">SSID unavailable</string>
<!-- Tooltip for the battery level when using a tethered device instead of a headset -->
<string name="tray_status_phone">Phone: %1$s</string>

</resources>
5 changes: 0 additions & 5 deletions app/src/visionglass/cpp/DeviceDelegateVisionGlass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,6 @@ DeviceDelegateVisionGlass::StartFrame(const FramePrediction aPrediction) {
if (!m.controller)
return;

if (auto context = m.context.lock()) {
float level = 100.0 - std::fmod(context->GetTimestamp(), 100.0);
m.controller->SetBatteryLevel(kControllerIndex, (int32_t)level);
}

vrb::Matrix transformMatrix;
if (auto context = m.context.lock()) {
float* filteredOrientation = m.orientationFilter->filter(context->GetTimestamp() * 1000000000, m.controllerOrientation.Data());
Expand Down