Add Context.getDisplayId() to avoid possible IPC

ContextImpl has an internal rule that when ContextImpl#mDisplay is
null the Context is associated with the default display.  The problem
is that, as discussed in Bug 117709581, when ContextImpl#mDisplay is
null ContextImpl#getDisplay() tries to get some non-null Display
object by making an IPC to the system server, which is redundant when
the display ID is the only thing that the caller wants to know.

By having an @hide method Context.getDisplayId(), we can ensure that
display ID can be obtained without any IPC.  This enables us to
re-submit my CL [1] that aimed to instantiate InputMethodManager (IMM)
for each display but then got reverted due to a performance regression
(Bug 117434607).

There should be no developer-observable behavior change.

 [1]: I7242e765426353672823fcc8277f20ac361930d7
      c53d78e992694e471ddaae73f9a30977db9cdb75

Fix: 117712745
Test: atest FrameworksCoreTests:android.content.ContextTest
Test: prebuilts/checkstyle/checkstyle.py -f \
      frameworks/base/core/tests/coretests/src/android/content/ContextTest.java
Change-Id: I2534530a5ce90e2620c5039d793a6454a0a1e154
12 files changed