1package com.android.server.wifi.hotspot2;
2
3/**
4 * Match score for EAP credentials:
5 * None means that there is a distinct mismatch, i.e. realm, method or parameter is defined
6 * and mismatches that of the credential.
7 * Indeterminate means that there is no ANQP information to match against.
8 * Note: The numeric values given to the constants are used for preference comparison and
9 * must be maintained accordingly.
10 */
11public abstract class AuthMatch {
12    public static final int None = -1;
13    public static final int Indeterminate = 0;
14    public static final int Realm = 0x04;
15    public static final int Method = 0x02;
16    public static final int Param = 0x01;
17    public static final int MethodParam = Method | Param;
18    public static final int Exact = Realm | Method | Param;
19
20    public static String toString(int match) {
21        if (match < 0) {
22            return "None";
23        }
24        else if (match == 0) {
25            return "Indeterminate";
26        }
27
28        StringBuilder sb = new StringBuilder();
29        if ((match & Realm) != 0) {
30            sb.append("Realm");
31        }
32        if ((match & Method) != 0) {
33            sb.append("Method");
34        }
35        if ((match & Param) != 0) {
36            sb.append("Param");
37        }
38        return sb.toString();
39    }
40}
41