• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 android.car.cts.builtin.user;
18 
19 import android.car.cts.builtin.CtsCarShellCommand;
20 
21 import com.android.tradefed.device.ITestDevice;
22 
23 public final class CarInitialUserCommand extends CtsCarShellCommand {
24 
25     private static final String COMMAND_NAME = "cmd car_service get-initial-user";
26 
27     // the value from UserHandler.USER_NULL
28     private static final int INVALID_USER_ID = -10_000;
29 
30     private int mCarInitialUser = INVALID_USER_ID;
31 
CarInitialUserCommand(ITestDevice device)32     public CarInitialUserCommand(ITestDevice device) {
33         super(COMMAND_NAME, device);
34     }
35 
getCarInitialUser()36     public int getCarInitialUser() {
37         return mCarInitialUser;
38     }
39 
40     @Override
parseCommandReturn()41     protected void parseCommandReturn() throws Exception {
42         mCarInitialUser = Integer.parseInt(mCommandReturn.trim());
43     }
44 }
45