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

Commit f12f652c authored by Neil Fuller's avatar Neil Fuller Committed by Android (Google) Code Review
Browse files

Merge "Revert "Add getUiccSlots() and switchSlots() in TelephonyManager.""

parents 421e7ec3 4cfc02a3
Loading
Loading
Loading
Loading
+0 −21
Original line number Diff line number Diff line
@@ -4622,7 +4622,6 @@ package android.telephony {
    method public int getSimApplicationState();
    method public int getSimCardState();
    method public java.util.List<android.telephony.TelephonyHistogram> getTelephonyHistograms();
    method public android.telephony.UiccSlotInfo[] getUiccSlotsInfo();
    method public android.os.Bundle getVisualVoicemailSettings();
    method public int getVoiceActivationState();
    method public boolean handlePinMmi(java.lang.String);
@@ -4649,7 +4648,6 @@ package android.telephony {
    method public int[] supplyPinReportResult(java.lang.String);
    method public boolean supplyPuk(java.lang.String, java.lang.String);
    method public int[] supplyPukReportResult(java.lang.String, java.lang.String);
    method public boolean switchSlots(int[]);
    method public void toggleRadioOnOff();
    method public void updateServiceLocation();
    field public static final java.lang.String ACTION_SIM_APPLICATION_STATE_CHANGED = "android.telephony.action.SIM_APPLICATION_STATE_CHANGED";
@@ -4671,25 +4669,6 @@ package android.telephony {
    field public static final int SIM_STATE_PRESENT = 11; // 0xb
  }

  public class UiccSlotInfo implements android.os.Parcelable {
    ctor public UiccSlotInfo(boolean, boolean, java.lang.String, int);
    method public int describeContents();
    method public java.lang.String getCardId();
    method public int getCardStateInfo();
    method public boolean getIsActive();
    method public boolean getIsEuicc();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int CARD_STATE_INFO_ABSENT = 1; // 0x1
    field public static final int CARD_STATE_INFO_ERROR = 3; // 0x3
    field public static final int CARD_STATE_INFO_PRESENT = 2; // 0x2
    field public static final int CARD_STATE_INFO_RESTRICTED = 4; // 0x4
    field public static final android.os.Parcelable.Creator<android.telephony.UiccSlotInfo> CREATOR;
    field public final java.lang.String cardId;
    field public final int cardStateInfo;
    field public final boolean isActive;
    field public final boolean isEuicc;
  }

  public abstract class VisualVoicemailService extends android.app.Service {
    method public static final void sendVisualVoicemailSms(android.content.Context, android.telecom.PhoneAccountHandle, java.lang.String, short, java.lang.String, android.app.PendingIntent);
    method public static final void setSmsFilterSettings(android.content.Context, android.telecom.PhoneAccountHandle, android.telephony.VisualVoicemailSmsFilterSettings);
+4 −48
Original line number Diff line number Diff line
@@ -22,13 +22,14 @@ import android.annotation.IntDef;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SuppressLint;
import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SystemApi;
import android.annotation.SystemService;
import android.annotation.WorkerThread;
import android.app.ActivityThread;
import android.app.PendingIntent;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
@@ -42,6 +43,7 @@ import android.os.RemoteException;
import android.os.ResultReceiver;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
import android.service.carrier.CarrierIdentifier;
import android.telecom.PhoneAccount;
@@ -61,6 +63,7 @@ import com.android.internal.telephony.CellNetworkScanResult;
import com.android.internal.telephony.IPhoneSubInfo;
import com.android.internal.telephony.ITelephony;
import com.android.internal.telephony.ITelephonyRegistry;
import com.android.internal.telephony.OperatorInfo;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.RILConstants;
import com.android.internal.telephony.TelephonyProperties;
@@ -2598,53 +2601,6 @@ public class TelephonyManager {
        }
    }

    /**
     * Gets all the UICC slots.
     *
     * @return UiccSlotInfo array.
     *
     * @hide
     */
    @SystemApi
    @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
    public UiccSlotInfo[] getUiccSlotsInfo() {
        try {
            ITelephony telephony = getITelephony();
            if (telephony == null) {
                return null;
            }
            return telephony.getUiccSlotsInfo();
        } catch (RemoteException e) {
            return null;
        }
    }

    /**
     * Map logicalSlot to physicalSlot, and activate the physicalSlot if it is inactive. For
     * example, passing the physicalSlots array [1, 0] means mapping the first item 1, which is
     * physical slot index 1, to the logical slot 0; and mapping the second item 0, which is
     * physical slot index 0, to the logical slot 1. The index of the array means the index of the
     * logical slots.
     *
     * @param physicalSlots Index i in the array representing physical slot for phone i. The array
     *        size should be same as {@link #getPhoneCount()}.
     * @return boolean Return true if the switch succeeds, false if the switch fails.
     * @hide
     */
    @SystemApi
    @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
    public boolean switchSlots(int[] physicalSlots) {
        try {
            ITelephony telephony = getITelephony();
            if (telephony == null) {
                return false;
            }
            return telephony.switchSlots(physicalSlots);
        } catch (RemoteException e) {
            return false;
        }
    }

    //
    //
    // Subscriber Info
+0 −19
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 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.
 */

package android.telephony;

parcelable UiccSlotInfo;
+0 −158
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 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.
 */
package android.telephony;

import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Objects;

import android.annotation.IntDef;

/**
 * Class for the information of a UICC slot.
 * @hide
 */
@SystemApi
public class UiccSlotInfo implements Parcelable {
    /**
     * Card state.
     * @hide
     */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef(prefix = { "CARD_STATE_INFO_" }, value = {
            CARD_STATE_INFO_ABSENT,
            CARD_STATE_INFO_PRESENT,
            CARD_STATE_INFO_ERROR,
            CARD_STATE_INFO_RESTRICTED
    })
    public @interface CardStateInfo {}

    /** Card state absent. */
    public static final int CARD_STATE_INFO_ABSENT = 1;

    /** Card state present. */
    public static final int CARD_STATE_INFO_PRESENT = 2;

    /** Card state error. */
    public static final int CARD_STATE_INFO_ERROR = 3;

    /** Card state restricted. */
    public static final int CARD_STATE_INFO_RESTRICTED = 4;

    public final boolean isActive;
    public final boolean isEuicc;
    public final String cardId;
    public final @CardStateInfo int cardStateInfo;

    public static final Creator<UiccSlotInfo> CREATOR = new Creator<UiccSlotInfo>() {
        @Override
        public UiccSlotInfo createFromParcel(Parcel in) {
            return new UiccSlotInfo(in);
        }

        @Override
        public UiccSlotInfo[] newArray(int size) {
            return new UiccSlotInfo[size];
        }
    };

    private UiccSlotInfo(Parcel in) {
        isActive = in.readByte() != 0;
        isEuicc = in.readByte() != 0;
        cardId = in.readString();
        cardStateInfo = in.readInt();
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeByte((byte) (isActive ? 1 : 0));
        dest.writeByte((byte) (isEuicc ? 1 : 0));
        dest.writeString(cardId);
        dest.writeInt(cardStateInfo);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public UiccSlotInfo(boolean isActive, boolean isEuicc, String cardId,
            @CardStateInfo int cardStateInfo) {
        this.isActive = isActive;
        this.isEuicc = isEuicc;
        this.cardId = cardId;
        this.cardStateInfo = cardStateInfo;
    }

    public boolean getIsActive() {
        return isActive;
    }

    public boolean getIsEuicc() {
        return isEuicc;
    }

    public String getCardId() {
        return cardId;
    }

    @CardStateInfo
    public int getCardStateInfo() {
        return cardStateInfo;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }

        UiccSlotInfo that = (UiccSlotInfo) obj;
        return (isActive == that.isActive)
                && (isEuicc == that.isEuicc)
                && (cardId == that.cardId)
                && (cardStateInfo == that.cardStateInfo);
    }

    @Override
    public int hashCode() {
        int result = 1;
        result = 31 * result + (isActive ? 1 : 0);
        result = 31 * result + (isEuicc ? 1 : 0);
        result = 31 * result + Objects.hashCode(cardId);
        result = 31 * result + cardStateInfo;
        return result;
    }

    @Override
    public String toString() {
        return "UiccSlotInfo (isActive="
                + isActive
                + ", isEuicc="
                + isEuicc
                + ", cardId="
                + cardId
                + ", cardState="
                + cardStateInfo
                + ")";
    }
}
+0 −16
Original line number Diff line number Diff line
@@ -47,7 +47,6 @@ import com.android.internal.telephony.OperatorInfo;

import java.util.List;

import android.telephony.UiccSlotInfo;

/**
 * Interface used to interact with the phone.  Mostly this is used by the
@@ -1445,19 +1444,4 @@ interface ITelephony {
     * @hide
     */
    SignalStrength getSignalStrength(int subId);

    /**
     * Get slot info for all the UICC slots.
     * @return UiccSlotInfo array.
     * @hide
     */
    UiccSlotInfo[] getUiccSlotsInfo();

    /**
     * Map logicalSlot to physicalSlot, and activate the physicalSlot if it is inactive.
     * @param physicalSlots Index i in the array representing physical slot for phone i. The array
     *        size should be same as getPhoneCount().
     * @return boolean Return true if the switch succeeds, false if the switch fails.
     */
    boolean switchSlots(in int[] physicalSlots);
}