32 lines
763 B
Java
32 lines
763 B
Java
|
package com.huawei.hms.api;
|
||
|
|
||
|
import java.util.List;
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
public class ProtocolNegotiate {
|
||
|
private static final int MAX_VERSION = 2;
|
||
|
private static ProtocolNegotiate instance = new ProtocolNegotiate();
|
||
|
private int version = 1;
|
||
|
|
||
|
public int negotiate(List<Integer> list) {
|
||
|
if (list == null || list.isEmpty()) {
|
||
|
this.version = 1;
|
||
|
return 1;
|
||
|
}
|
||
|
if (list.contains(2)) {
|
||
|
this.version = 2;
|
||
|
} else {
|
||
|
this.version = list.get(list.size() - 1).intValue();
|
||
|
}
|
||
|
return this.version;
|
||
|
}
|
||
|
|
||
|
public int getVersion() {
|
||
|
return this.version;
|
||
|
}
|
||
|
|
||
|
public static ProtocolNegotiate getInstance() {
|
||
|
return instance;
|
||
|
}
|
||
|
}
|