接觸Android Xposed開發也好久了,學了這麼久的Java,也該弄點東西出來了,ide
public ProximitySensor(Context paramContext, AudioModeProvider paramAudioModeProvider, AccelerometerListener paramAccelerometerListener) { this.mPowerManager = ((PowerManager)paramContext.getSystemService("power")); if (this.mPowerManager.isWakeLockLevelSupported(32)) {} for (this.mProximityWakeLock = this.mPowerManager.newWakeLock(32, TAG);; this.mProximityWakeLock = null) { this.mAccelerometerListener = paramAccelerometerListener; this.mAccelerometerListener.setListener(this); this.mDisplayListener = new ProximityDisplayListener((DisplayManager)paramContext.getSystemService("display")); this.mDisplayListener.register(); this.mAudioModeProvider = paramAudioModeProvider; this.mAudioModeProvider.addListener(this); return; Log.w(TAG, "Device does not support proximity wake lock."); } } private void turnOffProximitySensor(boolean paramBoolean) { if (this.mProximityWakeLock != null) { if (!this.mProximityWakeLock.isHeld()) { break label43; } Log.i(this, "Releasing proximity wake lock"); if (!paramBoolean) { break label38; } } label38: for (int i = 0;; i = 1) { this.mProximityWakeLock.release(i); return; } label43: Log.i(this, "Proximity wake lock already released"); } private void turnOnProximitySensor() { if (this.mProximityWakeLock != null) { if (!this.mProximityWakeLock.isHeld()) { Log.i(this, "Acquiring proximity wake lock"); this.mProximityWakeLock.acquire(); } } else {
這個是Android電話的APP,註冊了proximity listenerui
在turnOnProximitySensor給用Xposed替換掉以後,一些傳感器壞了的手機,又沒辦法禁用傳感器就能夠用我這個APP了this
連接:http://pan.baidu.com/s/1jHOren0 密碼:dnasspa