1 /* 2 * Copyright (C) 2022 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 17 package com.android.server.pm; 18 19 import android.annotation.Nullable; 20 21 /** 22 * A helper class that contains information about apex-system-service to be used within system 23 * server process. 24 */ 25 public final class ApexSystemServiceInfo implements Comparable<ApexSystemServiceInfo> { 26 27 final String mName; 28 @Nullable 29 final String mJarPath; 30 final int mInitOrder; 31 ApexSystemServiceInfo(String name, String jarPath, int initOrder)32 public ApexSystemServiceInfo(String name, String jarPath, int initOrder) { 33 this.mName = name; 34 this.mJarPath = jarPath; 35 this.mInitOrder = initOrder; 36 } 37 getName()38 public String getName() { 39 return mName; 40 } 41 getJarPath()42 public String getJarPath() { 43 return mJarPath; 44 } 45 getInitOrder()46 public int getInitOrder() { 47 return mInitOrder; 48 } 49 50 @Override compareTo(ApexSystemServiceInfo other)51 public int compareTo(ApexSystemServiceInfo other) { 52 if (mInitOrder == other.mInitOrder) { 53 return mName.compareTo(other.mName); 54 } 55 // higher initOrder values take precedence 56 return -Integer.compare(mInitOrder, other.mInitOrder); 57 } 58 } 59