-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1164 from DataDog/mconstantin/rumm-2769/fix-npe-i…
…n-sr-screen-recorder RUMM-2769 Fix NPE in ScreenRecorder when wrapping a null window.callback
- Loading branch information
Showing
3 changed files
with
261 additions
and
9 deletions.
There are no files selected for viewing
135 changes: 135 additions & 0 deletions
135
...n-replay/src/main/kotlin/com/datadog/android/sessionreplay/recorder/NoOpWindowCallback.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
/* | ||
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. | ||
* This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
* Copyright 2016-Present Datadog, Inc. | ||
*/ | ||
|
||
package com.datadog.android.sessionreplay.recorder | ||
|
||
import android.view.ActionMode | ||
import android.view.KeyEvent | ||
import android.view.Menu | ||
import android.view.MenuItem | ||
import android.view.MotionEvent | ||
import android.view.SearchEvent | ||
import android.view.View | ||
import android.view.Window | ||
import android.view.WindowManager | ||
import android.view.accessibility.AccessibilityEvent | ||
|
||
internal class NoOpWindowCallback : Window.Callback { | ||
|
||
// region Window.Callback | ||
override fun onActionModeFinished(mode: ActionMode?) { | ||
// No Op | ||
} | ||
|
||
override fun onCreatePanelView(featureId: Int): View? { | ||
// No Op | ||
return null | ||
} | ||
|
||
override fun dispatchTouchEvent(event: MotionEvent?): Boolean { | ||
// No Op | ||
return false | ||
} | ||
|
||
override fun onCreatePanelMenu(featureId: Int, menu: Menu): Boolean { | ||
// No Op | ||
return false | ||
} | ||
|
||
override fun onWindowStartingActionMode(callback: ActionMode.Callback?): ActionMode? { | ||
// No Op | ||
return null | ||
} | ||
|
||
override fun onWindowStartingActionMode( | ||
callback: ActionMode.Callback?, | ||
type: Int | ||
): ActionMode? { | ||
// No Op | ||
return null | ||
} | ||
|
||
override fun onAttachedToWindow() { | ||
// No Op | ||
} | ||
|
||
override fun dispatchGenericMotionEvent(event: MotionEvent?): Boolean { | ||
// No Op | ||
return false | ||
} | ||
|
||
@Suppress("FunctionMaxLength") | ||
override fun dispatchPopulateAccessibilityEvent(event: AccessibilityEvent?): Boolean { | ||
// No Op | ||
return false | ||
} | ||
|
||
override fun dispatchTrackballEvent(event: MotionEvent?): Boolean { | ||
// No Op | ||
return false | ||
} | ||
|
||
override fun dispatchKeyShortcutEvent(event: KeyEvent?): Boolean { | ||
// No Op | ||
return false | ||
} | ||
|
||
override fun dispatchKeyEvent(event: KeyEvent?): Boolean { | ||
// No Op | ||
return false | ||
} | ||
|
||
override fun onMenuOpened(featureId: Int, menu: Menu): Boolean { | ||
// No Op | ||
return false | ||
} | ||
|
||
override fun onPanelClosed(featureId: Int, menu: Menu) { | ||
// No Op | ||
} | ||
|
||
override fun onMenuItemSelected(featureId: Int, item: MenuItem): Boolean { | ||
// No Op | ||
return false | ||
} | ||
|
||
override fun onDetachedFromWindow() { | ||
// No Op | ||
} | ||
|
||
override fun onPreparePanel(featureId: Int, view: View?, menu: Menu): Boolean { | ||
// No Op | ||
return false | ||
} | ||
|
||
override fun onWindowAttributesChanged(attrs: WindowManager.LayoutParams?) { | ||
// No Op | ||
} | ||
|
||
override fun onWindowFocusChanged(hasFocus: Boolean) { | ||
// No Op | ||
} | ||
|
||
override fun onContentChanged() { | ||
// No Op | ||
} | ||
|
||
override fun onSearchRequested(): Boolean { | ||
// No Op | ||
return false | ||
} | ||
|
||
override fun onSearchRequested(searchEvent: SearchEvent?): Boolean { | ||
// No Op | ||
return false | ||
} | ||
|
||
override fun onActionModeStarted(mode: ActionMode?) { | ||
// No Op | ||
} | ||
|
||
// endregion | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters