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

Commit d427e029 authored by Adnan Begovic's avatar Adnan Begovic
Browse files

SystemUi: Don't show cellular data tile on secondary users.

  We don't show mobile network options for secondary users,
  don't show it as a tile either.

Change-Id: I91d3f88508c3a4ec3580fadd3ab3e9c01bd72e04
TICKET: CYNGNOS-1005
parent 2528351e
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -16,10 +16,12 @@

package com.android.systemui.qs.tiles;

import android.app.ActivityManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.os.UserHandle;
import android.provider.Settings;
import android.telephony.TelephonyManager;
import android.view.LayoutInflater;
@@ -87,6 +89,13 @@ public class CellularTile extends QSTile<QSTile.SignalState> {
        return new SignalTileView(context);
    }

    @Override
    protected void handleUserSwitch(int newUserId) {
        if (newUserId != UserHandle.USER_OWNER) {
            refreshState();
        }
    }

    @Override
    protected void handleClick() {
        if (mDataController.isMobileDataSupported()) {
@@ -107,7 +116,8 @@ public class CellularTile extends QSTile<QSTile.SignalState> {

    @Override
    protected void handleUpdateState(SignalState state, Object arg) {
        state.visible = mController.hasMobileDataFeature();
        state.visible = mController.hasMobileDataFeature()
                && (ActivityManager.getCurrentUser() == UserHandle.USER_OWNER);
        if (!state.visible) return;
        final CallbackInfo cb = (CallbackInfo) arg;
        if (cb == null) return;