'Invoking class under com.android.server.display in android using java reflection - possible or not?

I tried the following code but it throws "java.lang.ClassNotFoundException: com.android.server.display.DisplayModeDirector". Is this not possible or I'm just not doing it right?

val displayModeDirector = Class.forName("com.android.server.display.DisplayModeDirector")
val con = displayModeDirector.getConstructor(Context::class.java,Handler::class.java)
con.newInstance(applicationContext, Handler(Looper.getMainLooper()))

I am referring to this class



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source