Fix crash in AllInOneTetherSettings when user is not admin

When user is not admin, we should skip the setup and tear down
procedures in AllInOneTetherSettings' lifecycle. Also, the switch for
"Hotspot & tethering" on "Network & internet" should be disabled in such
case.

Bug: 151648198
Test: Build and flashed to crosshatch device. Using guest user, the
settings won't crash when using AllInOneTetherSetting and the switch is
disabled.

Change-Id: Ibd2f4111c53b8b9fa6a18504a681a27b966a3c46
diff --git a/src/com/android/settings/AllInOneTetherSettings.java b/src/com/android/settings/AllInOneTetherSettings.java
index 69edf43..c562fae 100644
--- a/src/com/android/settings/AllInOneTetherSettings.java
+++ b/src/com/android/settings/AllInOneTetherSettings.java
@@ -249,18 +249,31 @@
     @Override
     public void onResume() {
         super.onResume();
-        mTetherEnabler.addListener(mStateUpdateListener);
+        if (mUnavailable) {
+            return;
+        }
+        if (mTetherEnabler != null) {
+            mTetherEnabler.addListener(mStateUpdateListener);
+        }
     }
 
     @Override
     public void onPause() {
         super.onPause();
-        mTetherEnabler.removeListener(mStateUpdateListener);
+        if (mUnavailable) {
+            return;
+        }
+        if (mTetherEnabler != null) {
+            mTetherEnabler.removeListener(mStateUpdateListener);
+        }
     }
 
     @Override
     public void onStop() {
         super.onStop();
+        if (mUnavailable) {
+            return;
+        }
         final Context context = getContext();
         if (context != null) {
             context.unregisterReceiver(mTetherChangeReceiver);