Merge "statemachine migration from base to modules-utils" am: 51e6e8a0e1 am: 8cc1782ba5

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1893671

Change-Id: I5ba9d65a7223fbf9d1f371e672491f09b05c1940
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot 2022-06-15 01:25:27 +00:00 committed by Automerger Merge Worker
commit 4ecafadd7b
6 changed files with 1 additions and 4384 deletions

View File

@ -325,6 +325,7 @@ java_defaults {
"soundtrigger_middleware-aidl-java",
"modules-utils-build",
"modules-utils-preconditions",
"modules-utils-statemachine",
"modules-utils-synchronous-result-receiver",
"modules-utils-os",
"modules-utils-uieventlogger-interface",

View File

@ -417,27 +417,6 @@ filegroup {
],
}
java_library {
name: "modules-utils-statemachine",
srcs: [
"com/android/internal/util/IState.java",
"com/android/internal/util/State.java",
"com/android/internal/util/StateMachine.java",
],
libs: [
"framework-annotations-lib",
"unsupportedappusage",
],
sdk_version: "module_current",
min_sdk_version: "29",
visibility: ["//visibility:public"],
apex_available: [
"//apex_available:anyapex",
"//apex_available:platform",
],
}
filegroup {
name: "framework-ims-common-shared-srcs",
srcs: [

View File

@ -1,73 +0,0 @@
/**
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.internal.util;
import android.compat.annotation.UnsupportedAppUsage;
import android.os.Message;
/**
* {@hide}
*
* The interface for implementing states in a {@link StateMachine}
*/
public interface IState {
/**
* Returned by processMessage to indicate the message was processed.
*/
static final boolean HANDLED = true;
/**
* Returned by processMessage to indicate the message was NOT processed.
*/
static final boolean NOT_HANDLED = false;
/**
* Called when a state is entered.
*/
void enter();
/**
* Called when a state is exited.
*/
void exit();
/**
* Called when a message is to be processed by the
* state machine.
*
* This routine is never reentered thus no synchronization
* is needed as only one processMessage method will ever be
* executing within a state machine at any given time. This
* does mean that processing by this routine must be completed
* as expeditiously as possible as no subsequent messages will
* be processed until this routine returns.
*
* @param msg to process
* @return HANDLED if processing has completed and NOT_HANDLED
* if the message wasn't processed.
*/
boolean processMessage(Message msg);
/**
* Name of State for debugging purposes.
*
* @return name of state.
*/
@UnsupportedAppUsage
String getName();
}

View File

@ -1,83 +0,0 @@
/**
* Copyright (C) 2009 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.internal.util;
import android.annotation.SuppressLint;
import android.compat.annotation.UnsupportedAppUsage;
import android.os.Build;
import android.os.Message;
/**
* {@hide}
*
* The class for implementing states in a StateMachine
*/
@SuppressLint("AndroidFrameworkRequiresPermission")
public class State implements IState {
/**
* Constructor
*/
@UnsupportedAppUsage
protected State() {
}
/* (non-Javadoc)
* @see com.android.internal.util.IState#enter()
*/
@UnsupportedAppUsage
@Override
public void enter() {
}
/* (non-Javadoc)
* @see com.android.internal.util.IState#exit()
*/
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@Override
public void exit() {
}
/* (non-Javadoc)
* @see com.android.internal.util.IState#processMessage(android.os.Message)
*/
@UnsupportedAppUsage
@Override
public boolean processMessage(Message msg) {
return false;
}
/**
* Name of State for debugging purposes.
*
* This default implementation returns the class name, returning
* the instance name would better in cases where a State class
* is used for multiple states. But normally there is one class per
* state and the class name is sufficient and easy to get. You may
* want to provide a setName or some other mechanism for setting
* another name if the class name is not appropriate.
*
* @see com.android.internal.util.IState#processMessage(android.os.Message)
*/
@UnsupportedAppUsage
@Override
public String getName() {
String name = getClass().getName();
int lastDollar = name.lastIndexOf('$');
return name.substring(lastDollar + 1);
}
}

File diff suppressed because it is too large Load Diff