Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 33aaef85 authored by Paul Hu's avatar Paul Hu Committed by Automerger Merge Worker
Browse files

Merge "[TNU05] Add no upstream notification" am: cef08983 am: eabd2c38 am:...

Merge "[TNU05] Add no upstream notification" am: cef08983 am: eabd2c38 am: ae926677 am: 5ea6854a

Change-Id: I8c8792b39aa1a90ca6b731f9ee5ede8e5c84297e
parents c4af1968 5ea6854a
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -34,11 +34,14 @@
    <uses-permission android:name="android.permission.MODIFY_PHONE_STATE" />
    <uses-permission android:name="android.permission.MODIFY_PHONE_STATE" />
    <uses-permission android:name="android.permission.READ_DEVICE_CONFIG" />
    <uses-permission android:name="android.permission.READ_DEVICE_CONFIG" />
    <uses-permission android:name="android.permission.READ_NETWORK_USAGE_HISTORY" />
    <uses-permission android:name="android.permission.READ_NETWORK_USAGE_HISTORY" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
    <uses-permission android:name="android.permission.TETHER_PRIVILEGED" />
    <uses-permission android:name="android.permission.TETHER_PRIVILEGED" />
    <uses-permission android:name="android.permission.UPDATE_APP_OPS_STATS" />
    <uses-permission android:name="android.permission.UPDATE_APP_OPS_STATS" />
    <uses-permission android:name="android.permission.UPDATE_DEVICE_STATS" />
    <uses-permission android:name="android.permission.UPDATE_DEVICE_STATS" />
    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
    <uses-permission android:name="android.permission.WRITE_SETTINGS" />


    <protected-broadcast android:name="com.android.server.connectivity.tethering.DISABLE_TETHERING" />

    <application
    <application
        android:process="com.android.networkstack.process"
        android:process="com.android.networkstack.process"
        android:extractNativeLibs="false"
        android:extractNativeLibs="false"
+20 −0
Original line number Original line Diff line number Diff line
@@ -14,17 +14,7 @@
     limitations under the License.
     limitations under the License.
-->
-->
<resources>
<resources>
    <!-- String for no upstream notification title [CHAR LIMIT=200] -->
    <!-- Delay(millisecond) to show no upstream notification after there's no Backhaul. Set delay to
    <string name="no_upstream_notification_title">Tethering has no internet</string>
         "0" for disable this feature. -->
    <!-- String for no upstream notification title [CHAR LIMIT=200] -->
    <integer name="delay_to_show_no_upstream_after_no_backhaul">5000</integer>
    <string name="no_upstream_notification_message">Devices can\u2019t connect</string>
    <!-- String for no upstream notification disable button [CHAR LIMIT=200] -->
    <string name="no_upstream_notification_disable_button">Turn off tethering</string>

    <!-- String for cellular roaming notification title [CHAR LIMIT=200] -->
    <string name="upstream_roaming_notification_title">Hotspot or tethering is on</string>
    <!-- String for cellular roaming notification message [CHAR LIMIT=500] -->
    <string name="upstream_roaming_notification_message">Additional charges may apply while roaming</string>
    <!-- String for cellular roaming notification continue button [CHAR LIMIT=200] -->
    <string name="upstream_roaming_notification_continue_button">Continue</string>
</resources>
</resources>
 No newline at end of file
+20 −0
Original line number Original line Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2020 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<resources>
    <!-- Delay(millisecond) to show no upstream notification after there's no Backhaul. Set delay to
         "0" for disable this feature. -->
    <integer name="delay_to_show_no_upstream_after_no_backhaul">5000</integer>
</resources>
 No newline at end of file
+6 −0
Original line number Original line Diff line number Diff line
@@ -202,4 +202,10 @@
    <string name="tethering_notification_title">@string/tethered_notification_title</string>
    <string name="tethering_notification_title">@string/tethered_notification_title</string>
    <!-- String for tether enable notification message. -->
    <!-- String for tether enable notification message. -->
    <string name="tethering_notification_message">@string/tethered_notification_message</string>
    <string name="tethering_notification_message">@string/tethered_notification_message</string>

    <!-- No upstream notification is shown when there is a downstream but no upstream that is able
         to do the tethering. -->
    <!-- Delay(millisecond) to show no upstream notification after there's no Backhaul. Set delay to
         "-1" for disable this feature. -->
    <integer name="delay_to_show_no_upstream_after_no_backhaul">-1</integer>
</resources>
</resources>
+9 −1
Original line number Original line Diff line number Diff line
@@ -257,7 +257,7 @@ public class Tethering {
        mContext = mDeps.getContext();
        mContext = mDeps.getContext();
        mNetd = mDeps.getINetd(mContext);
        mNetd = mDeps.getINetd(mContext);
        mLooper = mDeps.getTetheringLooper();
        mLooper = mDeps.getTetheringLooper();
        mNotificationUpdater = mDeps.getNotificationUpdater(mContext);
        mNotificationUpdater = mDeps.getNotificationUpdater(mContext, mLooper);


        mPublicSync = new Object();
        mPublicSync = new Object();


@@ -337,6 +337,11 @@ public class Tethering {
        filter.addAction(ACTION_RESTRICT_BACKGROUND_CHANGED);
        filter.addAction(ACTION_RESTRICT_BACKGROUND_CHANGED);
        mContext.registerReceiver(mStateReceiver, filter, null, mHandler);
        mContext.registerReceiver(mStateReceiver, filter, null, mHandler);


        final IntentFilter noUpstreamFilter = new IntentFilter();
        noUpstreamFilter.addAction(TetheringNotificationUpdater.ACTION_DISABLE_TETHERING);
        mContext.registerReceiver(
                mStateReceiver, noUpstreamFilter, PERMISSION_MAINLINE_NETWORK_STACK, mHandler);

        final WifiManager wifiManager = getWifiManager();
        final WifiManager wifiManager = getWifiManager();
        if (wifiManager != null) {
        if (wifiManager != null) {
            wifiManager.registerSoftApCallback(mExecutor, new TetheringSoftApCallback());
            wifiManager.registerSoftApCallback(mExecutor, new TetheringSoftApCallback());
@@ -855,6 +860,8 @@ public class Tethering {
            } else if (action.equals(ACTION_RESTRICT_BACKGROUND_CHANGED)) {
            } else if (action.equals(ACTION_RESTRICT_BACKGROUND_CHANGED)) {
                mLog.log("OBSERVED data saver changed");
                mLog.log("OBSERVED data saver changed");
                handleDataSaverChanged();
                handleDataSaverChanged();
            } else if (action.equals(TetheringNotificationUpdater.ACTION_DISABLE_TETHERING)) {
                untetherAll();
            }
            }
        }
        }


@@ -2013,6 +2020,7 @@ public class Tethering {
        } finally {
        } finally {
            mTetheringEventCallbacks.finishBroadcast();
            mTetheringEventCallbacks.finishBroadcast();
        }
        }
        mNotificationUpdater.onUpstreamNetworkChanged(network);
    }
    }


    private void reportConfigurationChanged(TetheringConfigurationParcel config) {
    private void reportConfigurationChanged(TetheringConfigurationParcel config) {
Loading