[Settings] Support getSystemService(Class<T>)
Add getSystemService(Class<T>) to align the capability with framework
part.
Bug: 179640862
Test: local
Change-Id: I278951c2402aa8551cee37923f45626ab1830dd3
diff --git a/src/com/android/settings/SettingsPreferenceFragment.java b/src/com/android/settings/SettingsPreferenceFragment.java
index 659ada4..14402a7 100644
--- a/src/com/android/settings/SettingsPreferenceFragment.java
+++ b/src/com/android/settings/SettingsPreferenceFragment.java
@@ -439,6 +439,13 @@
}
/**
+ * Returns the specified system service from the owning Activity.
+ */
+ protected <T> T getSystemService(final Class<T> serviceClass) {
+ return getActivity().getSystemService(serviceClass);
+ }
+
+ /**
* Returns the PackageManager from the owning Activity.
*/
protected PackageManager getPackageManager() {