[Moto Z ROMs, Kernels, Recoveries, & Other Developm] schuby33:
Thanks for the rom, It's good to see the commits needed for the battery mods finally make it into an official build.

I am having an issue with my mods though. Whenever I attach a mod, the motomods app doesn't detect the mod straight away. Just now the motomods app crashed on me, and then took about 5 minutes to detect the mod. Other times I've had to put the mod on, and then pull it away from the phone by about 1-2millimetres and then the motomods app will activate and the mod works afterwards.

I gave the official stock oreo rom a try earlier today and the mods are detected instantly on that.

EDIT: Here's a logcat of me disconnecting the batterymod when it hasn't been recognised properly.

04-16 19:17:35.780 5776 5791 E AndroidRuntime: FATAL EXCEPTION: Greybus Monitor
04-16 19:17:35.780 5776 5791 E AndroidRuntime: Process: com.motorola.modservice, PID: 5776
04-16 19:17:35.780 5776 5791 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.Object[] java.util.Collection.toArray()' on a null object reference
04-16 19:17:35.780 5776 5791 E AndroidRuntime: at java.util.ArrayList.<init>(ArrayList.java:191)
04-16 19:17:35.780 5776 5791 E AndroidRuntime: at com.motorola.mod.ModDevice.<init>(SourceFile:360)
04-16 19:17:35.780 5776 5791 E AndroidRuntime: at com.motorola.modservice.aa.g(SourceFile:744)
04-16 19:17:35.780 5776 5791 E AndroidRuntime: at com.motorola.modservice.aa.b(SourceFile:55)
04-16 19:17:35.780 5776 5791 E AndroidRuntime: at com.motorola.modservice.aa$b.handleMessage(SourceFile:592)
04-16 19:17:35.780 5776 5791 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106)
04-16 19:17:35.780 5776 5791 E AndroidRuntime: at android.os.Looper.loop(Looper.java:164)
04-16 19:17:35.780 5776 5791 E AndroidRuntime: at android.os.HandlerThread.run(HandlerThread.java:65)
04-16 19:17:35.785 893 1925 W ContextImpl: Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:966 com.android.server.am.AppErrors.crashApplicationInner:393 com.android.server.am.AppErrors.crashApplication:321 com.android.server.am.ActivityManagerService.handleApplicationCrashInner:14489 com.android.server.am.ActivityManagerService.handleApplicationCrash:14471
04-16 19:17:35.787 5776 5791 I Process : Sending signal. PID: 5776 SIG: 9
04-16 19:17:35.802 514 514 I ServiceManager: service 'ModService' died
04-16 19:17:35.802 893 915 I ActivityManager: Process com.motorola.modservice (pid 5776) has died: svc SVC
04-16 19:17:35.802 893 927 W zygote64: kill(-5776, 9) failed: No such process
04-16 19:17:35.802 893 927 I zygote64: Successfully killed process cgroup uid 10028 pid 5776 in 0ms
04-16 19:17:35.806 893 915 W ActivityManager: Scheduling restart of crashed service com.motorola.modservice/.ModManagerService in 1000ms
04-16 19:17:35.815 893 4331 I ActivityManager: Killing 4465:com.google.android.calendar/u0a101 (adj 906): empty #17
04-16 19:17:35.816 893 927 W zygote64: kill(-4465, 9) failed: No such process
04-16 19:17:35.860 893 927 W zygote64: kill(-4465, 9) failed: No such process
04-16 19:17:35.860 893 927 I zygote64: Successfully killed process cgroup uid 10101 pid 4465 in 43ms
04-16 19:17:36.837 893 925 I ActivityManager: Start proc 5822:com.motorola.modservice/u0a28 for service com.motorola.modservice/.ModManagerService
04-16 19:17:36.896 5822 5822 I FirebaseInitProvider: FirebaseApp initialization unsuccessful
04-16 19:17:36.947 893 4331 W ActivityManager: Permission Denial: registerReceiver from com.motorola.modservice asks to run as user -1 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL
04-16 19:17:36.955 5822 5822 D ModConfig: f = /system/etc/permissions/com.motorola.mod.protocols.xml
04-16 19:17:36.958 5822 5822 D ModConfig: TAG = permissions
04-16 19:17:36.958 5822 5822 D ModConfig: name = modprotocol
04-16 19:17:36.958 5822 5822 I ModConfig: Got modprotocol HID
04-16 19:17:36.959 5822 5822 D ModConfig: name = modprotocol
04-16 19:17:36.960 5822 5822 I ModConfig: Got modprotocol BATTERY
04-16 19:17:36.960 5822 5822 D ModConfig: name = modprotocol
04-16 19:17:36.960 5822 5822 I ModConfig: Got modprotocol LIGHTS
04-16 19:17:36.960 5822 5822 D ModConfig: name = modprotocol
04-16 19:17:36.960 5822 5822 I ModConfig: Got modprotocol LOOPBACK
04-16 19:17:36.960 5822 5822 D ModConfig: name = modprotocol
04-16 19:17:36.960 5822 5822 I ModConfig: Got modprotocol FIRMWARE
04-16 19:17:36.960 5822 5822 D ModConfig: name = modprotocol
04-16 19:17:36.960 5822 5822 I ModConfig: Got modprotocol USB_EXT
04-16 19:17:36.960 5822 5822 D ModConfig: name = modprotocol
04-16 19:17:36.960 5822 5822 I ModConfig: Got modprotocol CAMERA_EXT
04-16 19:17:36.960 5822 5822 D ModConfig: name = modprotocol
04-16 19:17:36.960 5822 5822 I ModConfig: Got modprotocol MODS_DISPLAY
04-16 19:17:36.960 5822 5822 D ModConfig: name = modprotocol
04-16 19:17:36.960 5822 5822 I ModConfig: Got modprotocol PTP
04-16 19:17:36.960 5822 5822 D ModConfig: name = modprotocol
04-16 19:17:36.960 5822 5822 I ModConfig: Got modprotocol MODS_AUDIO
04-16 19:17:36.960 5822 5822 D ModConfig: name = modprotocol
04-16 19:17:36.960 5822 5822 I ModConfig: Got modprotocol RAW
04-16 19:17:36.960 5822 5822 D ModConfig: name = modprotocol
04-16 19:17:36.960 5822 5822 I ModConfig: Got modprotocol VENDOR
04-16 19:17:36.961 5822 5822 D ModConfig: f = /system/etc/permissions/com.motorola.mod.protocols.xml
04-16 19:17:36.962 5822 5822 D ModConfig: TAG = permissions
04-16 19:17:36.962 5822 5822 D ModConfig: name = modprotocol
04-16 19:17:36.962 5822 5822 I ModConfig: Got modprotocol HID
04-16 19:17:36.962 5822 5822 D ModConfig: name = modprotocol
04-16 19:17:36.962 5822 5822 I ModConfig: Got modprotocol BATTERY
04-16 19:17:36.963 5822 5822 D ModConfig: name = modprotocol
04-16 19:17:36.963 5822 5822 I ModConfig: Got modprotocol LIGHTS
04-16 19:17:36.963 5822 5822 D ModConfig: name = modprotocol
04-16 19:17:36.963 5822 5822 I ModConfig: Got modprotocol LOOPBACK
04-16 19:17:36.963 5822 5822 D ModConfig: name = modprotocol
04-16 19:17:36.963 5822 5822 I ModConfig: Got modprotocol FIRMWARE
04-16 19:17:36.963 5822 5822 D ModConfig: name = modprotocol
04-16 19:17:36.963 5822 5822 I ModConfig: Got modprotocol USB_EXT
04-16 19:17:36.963 5822 5822 D ModConfig: name = modprotocol
04-16 19:17:36.963 5822 5822 I ModConfig: Got modprotocol CAMERA_EXT
04-16 19:17:36.963 5822 5822 D ModConfig: name = modprotocol
04-16 19:17:36.963 5822 5822 I ModConfig: Got modprotocol MODS_DISPLAY
04-16 19:17:36.964 5822 5822 D ModConfig: name = modprotocol
04-16 19:17:36.964 5822 5822 I ModConfig: Got modprotocol PTP
04-16 19:17:36.964 5822 5822 D ModConfig: name = modprotocol
04-16 19:17:36.964 5822 5822 I ModConfig: Got modprotocol MODS_AUDIO
04-16 19:17:36.964 5822 5822 D ModConfig: name = modprotocol
04-16 19:17:36.964 5822 5822 I ModConfig: Got modprotocol RAW
04-16 19:17:36.964 5822 5822 D ModConfig: name = modprotocol
04-16 19:17:36.964 5822 5822 I ModConfig: Got modprotocol VENDOR
04-16 19:17:37.013 5822 5822 D OtaLibrary: OtaLibraryService.onCreate
04-16 19:17:37.016 5822 5822 D OtaLibrary: PollingManagerService()
04-16 19:17:37.016 5822 5822 D OtaLibrary: PollingManagerService init()
04-16 19:17:36.985 2732 2732 I fwkintentreceiver: Received intent: #Intent;action=com.motorola.mod.action.SERVICE_STARTED;launchFlags=0x1000010;component=com.motorola.modservice.fmwkwrapper/.IntentReceiver;end
04-16 19:17:36.954 893 4331 W ActivityManager: Permission Denial: registerReceiver from com.motorola.modservice asks to run as user -1 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL
04-16 19:17:37.024 2732 2732 W ContextImpl: Calling a method in the system process without a qualified user: android.app.ContextImpl.bindService:1556 android.content.ContextWrapper.bindService:684 com.motorola.modservice.fmwkwrapper.IntentReceiver.onReceive:106 android.app.ActivityThread.handleReceiver:3188 android.app.ActivityThread.-wrap17:0
04-16 19:17:37.047 5822 5822 D OtaLibrary: DataBaseImpl.DataBaseImpl
04-16 19:17:37.068 5822 5822 D OtaLibrary: DataBaseImpl.getAllDevices, found 2 device records
04-16 19:17:37.098 5822 5822 D OtaLibrary: StateMachineHandler.onStart
04-16 19:17:37.108 5822 5822 I OtaLibrary: SchedulePolling.configurePolling - Disabling the polling
04-16 19:17:37.108 5822 5822 D OtaLibrary: PollingManagerService, unregisterApp(): 65795-1768842089-00000000-2036-3355-3041-50170051003D
04-16 19:17:37.108 5822 5822 D OtaLibrary: PollingManagerService, unregisterApp(): 65795-1768842089-00000000-2036-3355-3041-50170051003D not registered.
04-16 19:17:37.109 5822 5822 D OtaLibrary: StateMachineHandler.onStart
04-16 19:17:37.122 5822 5822 I OtaLibrary: SchedulePolling.configurePolling - Disabling the polling
04-16 19:17:37.122 5822 5822 D OtaLibrary: PollingManagerService, unregisterApp(): ZY223WXH8K
04-16 19:17:37.122 5822 5822 D OtaLibrary: PollingManagerService, unregisterApp(): ZY223WXH8K not registered.
04-16 19:17:37.124 5822 5822 D OtaLibrary: OtaLibraryService.onBind
04-16 19:17:37.127 5822 5822 D OtaLibrary: PollingMangerService, phone state: {mVoiceRegState=0(IN_SERVICE), mDataRegState=0(IN_SERVICE), mVoiceRoamingType=home, mDataRoamingType=home, mVoiceOperatorAlphaLong=Woolworths, mVoiceOperatorAlphaShort=Woolworths, mDataOperatorAlphaLong=Woolworths, mDataOperatorAlphaShort=Woolworths, isManualNetworkSelection=false(automatic), mRilVoiceRadioTechnology=14(LTE), mRilDataRadioTechnology=14(LTE), mCssIndicator=unsupported, mNetworkId=-1, mSystemId=-1, mCdmaRoamingIndicator=-1, mCdmaDefaultRoamingIndicator=-1, mIsEmergencyOnly=false, mIsDataRoamingFromRegistration=false, mIsUsingCarrierAggregation=false, mLteEarfcnRsrpBoost=0}
04-16 19:17:37.128 5822 5822 V OtaLibrary: pollingManagerService, connectivity_action: [type: WIFI[], state: CONNECTED/CONNECTED, reason: (unspecified), extra: "Schubnet", failover: false, available: true, roaming: false]
04-16 19:17:37.131 5822 5822 D OtaLibrary: PollingManagerService.decideWhoNeedsPolling - now: 715616 ,futureTime: 9223372036854775807
04-16 19:17:37.131 5822 5822 I OtaLibrary: Received request for init
04-16 19:17:37.132 5822 5822 I OtaLibrary: OTANotificationManager.onReceive
04-16 19:17:37.138 5822 5846 I OtaLibrary: OTAMessageManager.handleMessage - RADIO_UP
04-16 19:17:37.138 5822 5846 D OtaLibrary: StateMachineHandler.onRadioUp
04-16 19:17:37.140 5822 5846 D OtaLibrary: StateMachineHandler.sendUpgradeStatus: no unlogged events.
04-16 19:17:37.157 5822 5846 E OtaLibrary: StateMachineHandler.runStateMachine - version descriptor is null
04-16 19:17:37.157 5822 5846 I OtaLibrary: OTAMessageManager.handleMessage - RADIO_UP
04-16 19:17:37.157 5822 5846 D OtaLibrary: StateMachineHandler.onRadioUp
04-16 19:17:37.159 5822 5846 D OtaLibrary: StateMachineHandler.sendUpgradeStatus: no unlogged events.
04-16 19:17:37.179 5822 5846 E OtaLibrary: StateMachineHandler.runStateMachine - version descriptor is null
04-16 19:17:37.900 565 653 I MotoSensors: Proximity uncovered
04-16 19:17:37.901 565 653 I MotoSensors: Sensorhub hal setEnable: sensor="Glance Gesture" handle=31 enable=0
04-16 19:17:37.918 2530 2530 D LineageActions-GlanceSensor: triggered
04-16 19:17:37.918 2530 2530 D LineageActions: Allowing doze
04-16 19:17:37.918 2530 2530 D LineageActions: Sending doze.pulse intent
04-16 19:17:37.918 2530 2530 W ContextImpl: Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:966 android.content.ContextWrapper.sendBroadcast:437 org.lineageos.settings.device.doze.DozePulseAction.action:51 org.lineageos.settings.device.doze.GlanceSensor$1.onTrigger:69 android.hardware.SystemSensorManager$TriggerEventQueue.dispatchSensorEvent:935
04-16 19:17:37.927 565 1228 D MotoSensors: batch:255 +
04-16 19:17:37.928 565 1228 I MotoSensors: Sensorhub hal batch: sensor="CT1011 Proximity" handle=13 period=200000000ns timeout=0ns
04-16 19:17:37.929 893 962 I DisplayPowerController: Blocking screen on until initial contents have been drawn.
04-16 19:17:37.935 893 954 I DisplayManagerService: Display device changed state: "Built-in Screen", ON
04-16 19:17:37.936 565 1228 D MotoSensors: batch:255 +
04-16 19:17:37.936 565 1228 I MotoSensors: Sensorhub hal batch: sensor="Glance Gesture" handle=31 period=1000000ns timeout=0ns
04-16 19:17:37.937 565 1228 D MotoSensors: activate:236 +
04-16 19:17:37.937 565 1228 D MotoSensors: activate:96 +
04-16 19:17:37.937 565 1228 I MotoSensors: Sensorhub hal setEnable: sensor="Glance Gesture" handle=31 enable=1
04-16 19:17:37.940 622 622 D SurfaceFlinger: Set power mode=2, type=0 flinger=0x7ad745f000
04-16 19:17:37.943 574 574 I SDM : DisplayBase::SetDisplayState: Set state = 1, display 0
04-16 19:17:37.948 893 1260 I InputReader: Reconfiguring input devices. changes=0x00000004
04-16 19:17:38.107 893 1738 D SurfaceControl: Excessive delay in setPowerMode()
04-16 19:17:38.122 893 962 I DisplayPowerController: Unblocked screen on after 194 ms
04-16 19:17:38.238 590 627 E ANDR-PERF-MPCTL: Invalid profile no. 0, total profiles 0 only
04-16 19:17:38.240 590 627 E ANDR-PERF-RESOURCEQS: Failed to apply optimization [4, 0]
04-16 19:17:38.244 590 627 E ANDR-PERF-RESOURCEQS: Failed to apply optimization [2, 0]
04-16 19:17:39.090 2530 2530 D LineageActions-FlatUpSensor: event: true mLastFlatUp=false mIsStowed=false
04-16 19:17:41.894 5822 5836 I zygote : Waiting for a blocking GC ProfileSaver
04-16 19:17:42.777 1740 1740 D HeadsetPhoneState: sendDeviceStateChanged. mService=1 mIsSimStateLoaded=true mSignal=4 mRoam=0 mBatteryCharge=4
04-16 19:17:45.334 1740 1740 D HeadsetPhoneState: sendDeviceStateChanged. mService=1 mIsSimStateLoaded=true mSignal=5 mRoam=0 mBatteryCharge=4
04-16 19:17:45.395 565 1228 D MotoSensors: batch:255 +
04-16 19:17:45.395 565 1228 I MotoSensors: Sensorhub hal batch: sensor="CT1011 Proximity" handle=13 period=200000000ns timeout=0ns
04-16 19:17:45.399 893 962 I DisplayPowerController: Blocking screen off
04-16 19:17:45.399 893 962 I DisplayPowerController: Unblocked screen off after 0 ms
04-16 19:17:45.402 893 954 I DisplayManagerService: Display device changed state: "Built-in Screen", OFF
04-16 19:17:45.412 893 1260 I InputReader: Reconfiguring input devices. changes=0x00000004
04-16 19:17:45.413 622 622 D SurfaceFlinger: Set power mode=0, type=0 flinger=0x7ad745f000
04-16 19:17:45.413 574 574 I SDM : DisplayBase::SetDisplayState: Set state = 0, display 0
04-16 19:17:45.415 1768 1768 D StatusBar: disable<e i a s b H R c s q >
04-16 19:17:45.518 1768 1768 I chatty : uid=10037(com.android.systemui) identical 2 lines
04-16 19:17:45.518 1768 1768 D StatusBar: disable<e i a s b H R c s q >
04-16 19:17:45.570 893 1738 D SurfaceControl: Excessive delay in setPowerMode()