blob: 399b03c2e48d9e45614cb45db9ad1e560c0f26da [file] [log] [blame]
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001/*
2 * Copyright (C) 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.server.pm;
18
19import java.util.Arrays;
20
21/**
22 * This is the key for the map of {@link android.content.pm.IntentFilterVerificationInfo}s
23 * maintained by the {@link com.android.server.pm.PackageManagerService}
24 */
25class IntentFilterVerificationKey {
26 public String domains;
27 public String packageName;
28 public String className;
29
30 public IntentFilterVerificationKey(String[] domains, String packageName, String className) {
31 StringBuilder sb = new StringBuilder();
32 for (String host : domains) {
33 sb.append(host);
34 }
35 this.domains = sb.toString();
36 this.packageName = packageName;
37 this.className = className;
38 }
39
40 @Override
41 public boolean equals(Object o) {
42 if (this == o) return true;
43 if (o == null || getClass() != o.getClass()) return false;
44
45 IntentFilterVerificationKey that = (IntentFilterVerificationKey) o;
46
47 if (domains != null ? !domains.equals(that.domains) : that.domains != null) return false;
48 if (className != null ? !className.equals(that.className) : that.className != null)
49 return false;
50 if (packageName != null ? !packageName.equals(that.packageName) : that.packageName != null)
51 return false;
52
53 return true;
54 }
55
56 @Override
57 public int hashCode() {
58 int result = domains != null ? domains.hashCode() : 0;
59 result = 31 * result + (packageName != null ? packageName.hashCode() : 0);
60 result = 31 * result + (className != null ? className.hashCode() : 0);
61 return result;
62 }
63}