Refactor DeviceStateManager service and tests.

This commit enhances the DeviceStateManagerService and its client-side
counterpart, DeviceStateManagerGlobal. The changes focus on improving
code quality, maintainability, and test reliability. JUnit assertions
in tests have been replaced with Truth, providing more informative
failure messages. Nullability annotations (@NonNull, @Nullable) have
been added to prevent potential null pointer exceptions. Java fields
are now marked as final where appropriate to improve code clarity and
signal immutability. The DeviceStateInfo class's Parcelable
implementation has been made more consistent, and handling of state
requests and callbacks in DeviceStateManagerGlobal has been streamlined.
The testng dependency has been removed from core device state tests.
These refinements prepare the DeviceStateManager codebase for future
improvements and align with best practices and style guidelines.

Bug: 337820752
Test: atest FrameworksCoreDeviceStateManagerTests
Test: atest FrameworksServicesTests:DeviceStateManagerServiceTest
Flag: TEST_ONLY
Change-Id: I9ab9b8dc51e2aa9d81f895394a584cb3175ae223
8 files changed