{"record":{"id":"d133d4af54680984","repo":"microg/GmsCore","slug":"op-code-request-opcode-not-supported","errorCode":null,"errorMessage":"Op code ${request.opCode} not supported","messagePattern":"Op code (.+?) not supported","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"play-services-location/core/src/main/kotlin/org/microg/gms/location/manager/LocationManagerInstance.kt","lineNumber":390,"sourceCode":"    }\n\n    // endregion\n\n    // endregion\n\n    // region Device Orientation\n\n    override fun updateDeviceOrientationRequest(request: DeviceOrientationRequestUpdateData) {\n        Log.d(TAG, \"updateDeviceOrientationRequest by ${getClientIdentity().packageName}\")\n        checkHasAnyLocationPermission()\n        val clientIdentity = getClientIdentity()\n        val callback = request.fusedLocationProviderCallback\n        lifecycleScope.launchWhenStarted {\n            try {\n                when (request.opCode) {\n                    REQUEST_UPDATES -> locationManager.deviceOrientationManager.add(clientIdentity, request.request, request.listener)\n                    REMOVE_UPDATES -> locationManager.deviceOrientationManager.remove(clientIdentity, request.listener)\n                    else -> throw UnsupportedOperationException(\"Op code ${request.opCode} not supported\")\n                }\n                callback?.onFusedLocationProviderResult(FusedLocationProviderResult.SUCCESS)\n            } catch (e: Exception) {\n                try {\n                    callback?.onFusedLocationProviderResult(FusedLocationProviderResult.create(Status(CommonStatusCodes.ERROR, e.message)))\n                } catch (e2: Exception) {\n                    Log.w(TAG, \"Failed\", e)\n                }\n            }\n        }\n    }\n\n    // endregion\n\n    private fun getClientIdentity() = ClientIdentity(packageName).apply { uid = getCallingUid(); pid = getCallingPid() }\n\n    private fun checkHasAnyLocationPermission() = checkHasAnyPermission(ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION)\n","sourceCodeStart":372,"sourceCodeEnd":408,"githubUrl":"https://github.com/microg/GmsCore/blob/157c9d86ac46c195a86c2f15ab55c84036223f95/play-services-location/core/src/main/kotlin/org/microg/gms/location/manager/LocationManagerInstance.kt#L372-L408","documentation":"LocationManagerInstance.updateDeviceOrientationRequest dispatches only REQUEST_UPDATES and REMOVE_UPDATES op codes; any other op code throws UnsupportedOperationException('Op code X not supported'). The exception message is forwarded to the FusedLocationProviderCallback as a failed FusedLocationProviderResult rather than crashing the caller. It guards against malformed or newer-protocol requests reaching the device-orientation handler.","triggerScenarios":"Sending a RequestDeviceOrientationRequest whose opCode is neither REQUEST_UPDATES nor REMOVE_UPDATES — e.g. a client compiled against a newer play-services API that added an op code microG does not implement, or a corrupted/ hand-crafted request.","commonSituations":"Running a new Google Play services client library (which introduced additional device-orientation op codes) against microG, which only implements the original two; tests passing sentinel op codes.","solutions":["Only invoke the supported operations: request updates or remove updates via the DeviceOrientationClient.","Check the operation/status result delivered to the callback and handle Status with code CommonStatusCodes.ERROR gracefully.","Update microG to a version supporting the op code, or pin the app to an older play-services-location client version whose op codes are implemented."],"exampleFix":"// before\ndeviceOrientationClient.requestDeviceOrientationUpdates(request, callback) // opCode=UNKNOWN from newer client\n// after\n// use only supported ops\ndeviceOrientationClient.requestDeviceOrientationUpdates(orientationRequest, listener) // REQUEST_UPDATES\ndeviceOrientationClient.removeDeviceOrientationUpdates(listener) // REMOVE_UPDATES","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"fun isSupportedOrientationOpCode(opCode: Int) = opCode == REQUEST_UPDATES || opCode == REMOVE_UPDATES","tryCatchPattern":"deviceOrientationClient.requestDeviceOrientationUpdates(req, listener) // result arrives via callback\n// in callback:\noverride fun onFusedLocationProviderResult(result: FusedLocationProviderResult) {\n    if (!result.status.isSuccess && result.status.message?.contains(\"not supported\") == true) {\n        // fall back to plain location updates\n    }\n}","preventionTips":["Only use documented DeviceOrientationClient operations","Keep microG and play-services client versions compatible","Handle failed FusedLocationProviderResult statuses defensively"],"tags":["unsupported-operation","location","op-code","android"],"backgroundTag":"unsupported-operation","analyzedSha":"157c9d86ac46c195a86c2f15ab55c84036223f95","analyzedAt":"2026-09-06T17:27:33.892Z","contentChangedAt":"2026-09-06T17:27:33.892Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}