Merge "Add textview and framelayout inflation cases, refactor."

am: 1b3687c0e9

Change-Id: I67d3205ecc2518570ea8ebda5bb60dd86d722cf4
This commit is contained in:
Carmen Jackson
2019-06-26 21:56:22 -07:00
committed by android-build-merger
11 changed files with 10219 additions and 58 deletions

View File

@@ -18,6 +18,9 @@ android_app {
name: "startop_test_app",
srcs: [
"src/EmptyActivity.java",
"src/LayoutInflation.java",
"src/LayoutInflationActivity.java",
"src/ComplexLayoutInflationActivity.java",
"src/FrameLayoutInflationActivity.java",
"src/TextViewInflationActivity.java",
],
}

View File

@@ -23,7 +23,12 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true">
<activity android:name=".EmptyActivity">
<activity
android:label="Complex Layout Test"
android:name=".ComplexLayoutInflationActivity"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -31,7 +36,41 @@
</intent-filter>
</activity>
<activity android:name=".LayoutInflation" android:exported="true" />
<activity
android:label="Empty Activity Layout Test"
android:name=".EmptyActivity"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:label="FrameLayout Layout Test"
android:name=".FrameLayoutInflationActivity"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:label="TextView Layout Test"
android:name=".TextViewInflationActivity"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

View File

@@ -23,4 +23,4 @@ The activity adds an `inflate#activity_main` slice to atrace around the time
spent in view inflation to make it easier to focus on the time spent in view
inflation.
adb shell am start -n com.android.startop.test/.LayoutInflation
adb shell am start -n com.android.startop.test/.ComplexLayoutInflationActivity

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,34 @@
/*
* Copyright (C) 2019 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.startop.test;
import android.os.Bundle;
/**
* This activity inflates a reasonably complex layout to see the impact of
* layout inflation. The layout is supported by the viewcompiler, so this can be
* used for testing precompiled layout performance.
*/
public class ComplexLayoutInflationActivity extends LayoutInflationActivity {
protected void onCreate(Bundle savedInstanceState) {
Bundle newState = savedInstanceState == null
? new Bundle() : new Bundle(savedInstanceState);
newState.putInt(LAYOUT_ID, R.layout.activity_main);
super.onCreate(newState);
}
}

View File

@@ -1,18 +1,18 @@
//
// Copyright (C) 2019 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.
//
/*
* Copyright (C) 2019 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.startop.test;

View File

@@ -0,0 +1,29 @@
/*
* Copyright (C) 2019 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.startop.test;
import android.os.Bundle;
public class FrameLayoutInflationActivity extends LayoutInflationActivity {
protected void onCreate(Bundle savedInstanceState) {
Bundle newState = savedInstanceState == null
? new Bundle() : new Bundle(savedInstanceState);
newState.putInt(LAYOUT_ID, R.layout.framelayout_list);
super.onCreate(newState);
}
}

View File

@@ -1,39 +0,0 @@
//
// Copyright (C) 2019 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.startop.test;
import android.app.Activity;
import android.os.Bundle;
import android.os.Trace;
import android.view.LayoutInflater;
import android.view.View;
/**
* This activity inflates a reasonably complex layout to see the impact of
* layout inflation. The layout is supported by the viewcompiler, so this can be
* used for testing precompiled layout performance.
*/
public class LayoutInflation extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LayoutInflater inflater = LayoutInflater.from(this);
Trace.beginSection("inflate layout:activity_main");
View view = inflater.inflate(R.layout.activity_main, /*root=*/null);
Trace.endSection();
setContentView(view);
}
}

View File

@@ -0,0 +1,39 @@
/*
* Copyright (C) 2019 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.startop.test;
import android.app.Activity;
import android.os.Bundle;
import android.os.Trace;
import android.view.LayoutInflater;
import android.view.View;
public class LayoutInflationActivity extends Activity {
public static String LAYOUT_ID = "layout-id";
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
int layoutId = savedInstanceState.getInt(LAYOUT_ID);
String layoutName = getResources().getResourceEntryName(layoutId);
LayoutInflater inflater = LayoutInflater.from(this);
Trace.beginSection("inflate layout: " + layoutName);
View view = inflater.inflate(layoutId, /*root=*/null);
Trace.endSection();
setContentView(view);
}
}

View File

@@ -0,0 +1,29 @@
/*
* Copyright (C) 2019 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.startop.test;
import android.os.Bundle;
public class TextViewInflationActivity extends LayoutInflationActivity {
protected void onCreate(Bundle savedInstanceState) {
Bundle newState = savedInstanceState == null
? new Bundle() : new Bundle(savedInstanceState);
newState.putInt(LAYOUT_ID, R.layout.textview_list);
super.onCreate(newState);
}
}