Skip to content
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 @@ -381,7 +381,7 @@ fun Main() {
TroubleshootingScreen(navController)
}
composable("head_tracking") {
HeadTrackingScreen(navController)
HeadTrackingScreen()
}
composable("onboarding") {
Onboarding(navController, context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,12 @@ fun StyledToggle(
val attManager = ServiceManager.getService()?.attManager ?: return
val isDarkTheme = isSystemInDarkTheme()
val textColor = if (isDarkTheme) Color.White else Color.Black
val checkedValue = attManager.read(attHandle).getOrNull(0)?.toInt()
val checkedValue = try {
attManager.read(attHandle).getOrNull(0)?.toInt()
} catch (e: Exception) {
Log.w("StyledToggle", "Error reading initial value for $label: ${e.message}")
null
} ?: 0
var checked by remember { mutableStateOf(checkedValue !=0) }
var backgroundColor by remember { mutableStateOf(if (isDarkTheme) Color(0xFF1C1C1E) else Color(0xFFFFFFFF)) }
val animatedBackgroundColor by animateColorAsState(targetValue = backgroundColor, animationSpec = tween(durationMillis = 500))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/


// this is absolutely unnecessary, why did I make this. a simple toggle would've sufficed

@file:OptIn(ExperimentalEncodingApi::class)

package me.kavishdevar.librepods.screens
Expand Down Expand Up @@ -83,7 +86,6 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.navigation.NavController
import com.kyant.backdrop.backdrops.layerBackdrop
import com.kyant.backdrop.backdrops.rememberLayerBackdrop
import dev.chrisbanes.haze.hazeSource
Expand All @@ -108,7 +110,7 @@ import kotlin.random.Random
@RequiresApi(Build.VERSION_CODES.Q)
@OptIn(ExperimentalMaterial3Api::class, ExperimentalAnimationApi::class)
@Composable
fun HeadTrackingScreen(navController: NavController) {
fun HeadTrackingScreen() {
DisposableEffect(Unit) {
ServiceManager.getService()?.startHeadTracking()
onDispose {
Expand Down Expand Up @@ -743,5 +745,5 @@ private fun AccelerationPlot() {
@Preview
@Composable
fun HeadTrackingScreenPreview() {
HeadTrackingScreen(navController = NavController(LocalContext.current))
HeadTrackingScreen()
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ class AACPManager {
eqData = FloatArray(8) { i -> eq1.get(i) }
Log.d(TAG, "EQ Data set to: ${eqData.toList()}, eqOnPhone: $eqOnPhone, eqOnMedia: $eqOnMedia")
}

Opcodes.INFORMATION -> {
Log.e(TAG, "Parsing Information Packet")
val information = parseInformationPacket(packet)
Expand Down Expand Up @@ -1201,7 +1201,8 @@ class AACPManager {
var offset = 9
for (i in 0 until deviceCount) {
if (offset + 8 > data.size) {
throw IllegalArgumentException("Data array too short to parse all connected devices")
Log.w(TAG, "Data array too short to parse all connected devices, returning what we have")
break
}
val macBytes = data.sliceArray(offset until offset + 6)
val mac = macBytes.joinToString(":") { "%02X".format(it) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ class AirPodsPro2Lightning: AirPodsBase(
Capability.HEARING_AID,
Capability.ADAPTIVE_AUDIO,
Capability.ADAPTIVE_VOLUME,
Capability.SWIPE_FOR_VOLUME
Capability.SWIPE_FOR_VOLUME,
Capability.HEAD_GESTURES
)
)

Expand All @@ -171,7 +172,8 @@ class AirPodsPro2USBC: AirPodsBase(
Capability.HEARING_AID,
Capability.ADAPTIVE_AUDIO,
Capability.ADAPTIVE_VOLUME,
Capability.SWIPE_FOR_VOLUME
Capability.SWIPE_FOR_VOLUME,
Capability.HEAD_GESTURES
)
)

Expand Down Expand Up @@ -230,4 +232,4 @@ object AirPodsModels {
fun getModelByModelNumber(modelNumber: String): AirPodsBase? {
return models.find { modelNumber in it.modelNumber }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ class RadareOffsetFinder(context: Context) {
}

fun isSdpOffsetAvailable(): Boolean {
val sharedPreferences = ServiceManager.getService()?.applicationContext?.getSharedPreferences("settings", Context.MODE_PRIVATE) // ik not good practice- too lazy
if (sharedPreferences?.getBoolean("skip_setup", false) == true) {
Log.d(TAG, "Setup skipped, returning true for SDP offset.")
return true
}
try {
val process = Runtime.getRuntime().exec(arrayOf("/system/bin/getprop", SDP_OFFSET_PROP))
val reader = BufferedReader(InputStreamReader(process.inputStream))
Expand Down Expand Up @@ -462,7 +467,7 @@ class RadareOffsetFinder(context: Context) {
// findAndSaveL2cuProcessCfgReqOffset(libraryPath, envSetup)
// findAndSaveL2cCsmConfigOffset(libraryPath, envSetup)
// findAndSaveL2cuSendPeerInfoReqOffset(libraryPath, envSetup)

// findAndSaveSdpOffset(libraryPath, envSetup) Should not be run by default, only when user asks for it.

} catch (e: Exception) {
Expand Down