Context. Solar energetic transients such as flares and coronal mass ejections occur mostly within active regions (ARs) and release large amounts of energy, which is expected to excite acoustic waves by transferring the mechanical impulse of the thermal expansion of the flare on the photosphere. On the other hand, strong magnetic fields of AR sunspots absorb the power of the photospheric oscillation modes. Aims. We study the properties of high-degree p-mode oscillations in flaring and dormant ARs and compare them with those in corresponding quiet regions (QRs) to find the association of the mode parameters with magnetic-and flare-related activities. Methods. We computed the mode parameters using the ring-diagram technique. The magnetic-activity indices (MAIs) of ARs and QRs were determined from the line-of-sight magnetograms. The flare indices (FIs) of ARs were obtained from the GOES X-ray fluxes. Mode parameters were corrected for foreshortening, duty cycle, and MAI using multiple non-linear regression. Results. Our analysis of several flaring and dormant ARs observed during the Carrington rotations 1980-2109 showed a strong association of the mode amplitude, width, and energy with magnetic and flare activities, although their changes are combined effects of foreshortening, duty cycle, magnetic-activity, flare-activity, and measurement uncertainties. We find that the largest reduction in mode amplitude and background power of an AR are caused by the angular distance of the AR from the solar disc centre. After correcting the mode parameters for foreshortening and duty cycle, we find that the mode amplitudes of flaring and dormant ARs are lower than in corresponding QRs reducing with increasing MAI, suggesting a stronger mode power suppression in ARs with larger magnetic fields. The mode widths in ARs are larger than in corresponding QRs and increase with MAI, indicating shorter lifetimes of modes in ARs than in QRs. The variations in mode amplitude and width with MAI are not same in different frequency bands. The largest amplification (reduction) in mode amplitude (mode width) of dormant ARs is found in the five-minute frequency band. The average mode energy of both the flaring and dormant ARs is smaller than in their corresponding QRs, reducing with increasing MAI. But the average mode energy reduction rate in flaring ARs is smaller than in dormant ARs. Moreover, the increase in mode width rate in dormant (flaring) ARs is followed by a decrease (increase) in the amplitude variation rate. Furthermore, including the mode corrections for MAI shows that mode amplitude and mode energy of flaring ARs escalate with FI, while the mode width shows an opposite trend, suggesting excitations of modes and growth in their lifetimes by flares. The increase (decrease) in mode amplitude (width) is larger in the five-minute and higher-frequency bands. The enhancement in width variation rate is followed by a rapid decline in the amplitude variation rate.